packages feed

tasty-golden 2.3.3 → 2.3.3.1

raw patch · 4 files changed

+29/−12 lines, 4 filesdep +textdep ~optparse-applicativePVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependencies added: text

Dependency ranges changed: optparse-applicative

API changes (from Hackage documentation)

+ Test.Tasty.Golden: [getSizeCutoff] :: SizeCutoff -> Int64

Files

CHANGELOG.md view
@@ -1,6 +1,11 @@ Changes ======= +Version 2.3.3.1+---------------++* Fix a bug with UTF-8 output+ Version 2.3.3 ------------- 
Test/Tasty/Golden.hs view
@@ -62,8 +62,10 @@ import Test.Tasty.Golden.Advanced import Test.Tasty.Golden.Internal import Text.Printf-import qualified Data.ByteString.Lazy.Char8 as LBS+import qualified Data.ByteString.Lazy as LBS import Data.Monoid+import qualified Data.Text.Lazy as LT+import qualified Data.Text.Lazy.Encoding as LT import System.IO import System.IO.Temp import System.Process@@ -111,7 +113,7 @@   cmp sizeCutoff x y = simpleCmp msg x y     where     msg = printf "Test output was different from '%s'. It was:\n" ref <>-      LBS.unpack (truncateLargeOutput sizeCutoff y)+      unpackUtf8 (truncateLargeOutput sizeCutoff y)   upd = createDirectoriesAndWriteFile ref  simpleCmp :: Eq a => String -> a -> a -> IO (Maybe String)@@ -152,7 +154,7 @@     r <- waitForProcess pid     return $ case r of       ExitSuccess -> Nothing-      _ -> Just . LBS.unpack . truncateLargeOutput sizeCutoff $ out+      _ -> Just . unpackUtf8 . truncateLargeOutput sizeCutoff $ out    upd _ = readFileStrict new >>= createDirectoriesAndWriteFile ref @@ -195,7 +197,7 @@     r <- waitForProcess pid     return $ case r of       ExitSuccess -> Nothing-      _ -> Just (printf "Test output was different from '%s'. Output of %s:\n" ref (show cmd) <> LBS.unpack (truncateLargeOutput sizeCutoff out))+      _ -> Just (printf "Test output was different from '%s'. Output of %s:\n" ref (show cmd) <> unpackUtf8 (truncateLargeOutput sizeCutoff out))    upd = createDirectoriesAndWriteFile ref @@ -288,3 +290,6 @@   s <- LBS.hGetContents h   evaluate $ forceLbs s   return s++unpackUtf8 :: LBS.ByteString -> String+unpackUtf8 = LT.unpack . LT.decodeUtf8
Test/Tasty/Golden/Internal.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE RankNTypes, ExistentialQuantification, DeriveDataTypeable,-    MultiParamTypeClasses, GeneralizedNewtypeDeriving #-}+    MultiParamTypeClasses, GeneralizedNewtypeDeriving, CPP #-} module Test.Tasty.Golden.Internal where  import Control.DeepSeq@@ -8,9 +8,12 @@ import Data.Proxy import Data.Int import System.IO.Error (isDoesNotExistError)-import Options.Applicative (metavar)+import Options.Applicative (metavar, showDefaultWith, value) import Test.Tasty.Providers import Test.Tasty.Options+#if !MIN_VERSION_base(4,11,0)+import Data.Monoid ((<>))+#endif  -- | See 'goldenTest' for explanation of the fields data Golden =@@ -49,14 +52,17 @@ -- for readability. -- -- The default value is 1000 (i.e. 1Kb).-newtype SizeCutoff = SizeCutoff Int64+newtype SizeCutoff = SizeCutoff { getSizeCutoff :: Int64 }   deriving (Eq, Ord, Typeable, Num, Real, Enum, Integral) instance IsOption SizeCutoff where   defaultValue = 1000   parseValue = fmap SizeCutoff . safeRead . filter (/= '_')   optionName = return "size-cutoff"   optionHelp = return "hide golden test output if it's larger than n bytes"-  optionCLParser = mkOptionCLParser $ metavar "n"+  optionCLParser = mkOptionCLParser $+    metavar "n" <>+    value defaultValue <>+    showDefaultWith (show . getSizeCutoff)  instance IsTest Golden where   run opts golden _ = runGolden golden opts
tasty-golden.cabal view
@@ -1,5 +1,5 @@ name:                tasty-golden-version:             2.3.3+version:             2.3.3.1 synopsis:            Golden tests support for tasty description:   This package provides support for «golden testing».@@ -17,7 +17,7 @@ Bug-reports:         https://github.com/feuerbach/tasty-golden/issues author:              Roman Cheplyaka maintainer:          Roman Cheplyaka <roma@ro-che.info>--- copyright:           +-- copyright: category:            Testing build-type:          Simple cabal-version:       >=1.14@@ -56,14 +56,15 @@     bytestring >= 0.9.2.1,     process,     mtl,-    optparse-applicative,+    optparse-applicative >= 0.3.1,     filepath,     temporary,     tagged,     deepseq,     containers,     directory,-    async+    async,+    text  Test-suite test   Default-language: