packages feed

tasty-golden 2.3.5 → 2.3.6

raw patch · 7 files changed

+114/−31 lines, 7 filesdep −asyncdep −mtldep −taggeddep ~basenew-uploaderPVP ok

version bump matches the API change (PVP)

Dependencies removed: async, mtl, tagged

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Test.Tasty.Golden: NoCreateFile :: Bool -> NoCreateFile
+ Test.Tasty.Golden: newtype NoCreateFile

Files

CHANGELOG.md view
@@ -1,12 +1,22 @@ Changes ======= +Version 2.3.6+-------------++* Option `--no-create-file` now available internally as `NoCreateFile`+  ([Issue #50](https://github.com/UnkindPartition/tasty-golden/issues/50))+* Drop support for GHC 7, remove obsolete `deriving Typeable`+* Tested with GHC 8.0 - 9.14.1++_Andreas Abel, 2026-02-01_+ Version 2.3.5 ------------- -* Fixes for launching external processes (like diff) on Windows-* Update the golden file on --accept if decoding the golden file failed with an exception-* Do not depend on unix-compat+* Fixes for launching external processes (like `diff`) on Windows+* Update the golden file on `--accept` if decoding the golden file failed with an exception+* Do not depend on `unix-compat`  Version 2.3.4 -------------@@ -71,12 +81,12 @@ Version 2.3.0.2 --------------- -Switch from temporary-rc to temporary+Switch from `temporary-rc` to `temporary`  Version 2.3.0.1 --------------- -Impose a lower bound version constraint on bytestring.+Impose a lower bound version constraint on `bytestring`.  Version 2.3 -----------
+ README.md view
@@ -0,0 +1,58 @@+This package provides support for «golden testing».++A golden test is an IO action that writes its result to a file.+To pass the test, this output file should be identical to the corresponding+«golden» file, which contains the correct result for the test.++To **get started** with golden testing and this library, see+[Introduction to golden testing](https://ro-che.info/articles/2017-12-04-golden-tests).++Command-line options+--------------------++To see the command-line options, run your test suite with `--help`. Here's an+example output:++```+Mmm... tasty test suite++Usage: test [-p|--pattern PATTERN] [-t|--timeout DURATION] [-l|--list-tests]+            [-j|--num-threads NUMBER] [-q|--quiet] [--hide-successes]+            [--color never|always|auto] [--ansi-tricks ARG] [--accept]+            [--no-create] [--size-cutoff n]+            [--delete-output never|onpass|always]++Available options:+  -h,--help                Show this help text+  -p,--pattern PATTERN     Select only tests which satisfy a pattern or awk+                           expression+  -t,--timeout DURATION    Timeout for individual tests (suffixes: ms,s,m,h;+                           default: s)+  -l,--list-tests          Do not run the tests; just print their names+  -j,--num-threads NUMBER  Number of threads to use for tests+                           execution (default: # of cores/capabilities)+  -q,--quiet               Do not produce any output; indicate success only by+                           the exit code+  --hide-successes         Do not print tests that passed successfully+  --color never|always|auto+                           When to use colored output (default: auto)+  --ansi-tricks ARG        Enable various ANSI terminal tricks. Can be set to+                           'true' or 'false'. (default: true)+  --accept                 Accept current results of golden tests+  --no-create              Error when golden file does not exist+  --size-cutoff n          hide golden test output if it's larger than n+                           bytes (default: 1000)+  --delete-output never|onpass|always+                           If there is a golden file, when to delete output+                           files (default: never)+```++See also [tasty's README](https://github.com/UnkindPartition/tasty/blob/master/README.md#runtime).++Maintainers+-----------++[Roman Cheplyaka](https://github.com/UnkindPartition) is the primary maintainer.++[Oliver Charles](https://github.com/ocharles) is the backup maintainer. Please+get in touch with him if the primary maintainer cannot be reached.
Test/Tasty/Golden.hs view
@@ -81,6 +81,7 @@     -- * Options   , SizeCutoff(..)   , DeleteOutputFile(..)+  , NoCreateFile(..)     -- * Various utilities   , writeBinaryFile   , findByExtension
Test/Tasty/Golden/Internal.hs view
@@ -1,11 +1,10 @@-{-# LANGUAGE RankNTypes, ExistentialQuantification, DeriveDataTypeable,+{-# LANGUAGE RankNTypes, ExistentialQuantification,     MultiParamTypeClasses, GeneralizedNewtypeDeriving, CPP #-} module Test.Tasty.Golden.Internal where  import Control.DeepSeq import Control.Exception import Control.Monad (when)-import Data.Typeable (Typeable) import Data.Proxy import Data.Int import Data.Char (toLower)@@ -26,12 +25,11 @@       (a -> a -> IO (Maybe String))       (a -> IO ())       (IO ())-  deriving Typeable  -- | This option, when set to 'True', specifies that we should run in the -- «accept tests» mode newtype AcceptTests = AcceptTests Bool-  deriving (Eq, Ord, Typeable)+  deriving (Eq, Ord) instance IsOption AcceptTests where   defaultValue = AcceptTests False   parseValue = fmap AcceptTests . safeReadBool@@ -41,8 +39,10 @@  -- | This option, when set to 'True', specifies to error when a file does -- not exist, instead of creating a new file.+--+-- @since 2.3.6 newtype NoCreateFile = NoCreateFile Bool-  deriving (Eq, Ord, Typeable)+  deriving (Eq, Ord) instance IsOption NoCreateFile where   defaultValue = NoCreateFile False   parseValue = fmap NoCreateFile . safeReadBool@@ -58,7 +58,7 @@ -- -- @since 2.3.3 newtype SizeCutoff = SizeCutoff { getSizeCutoff :: Int64 }-  deriving (Eq, Ord, Typeable, Num, Real, Enum, Integral)+  deriving (Eq, Ord, Num, Real, Enum, Integral) instance IsOption SizeCutoff where   defaultValue = 1000   showDefaultValue = Just . show . getSizeCutoff@@ -76,7 +76,7 @@   | OnPass -- ^ Delete the output file if the test passes   | Always -- ^ Always delete the output file. (May not be commonly used,            --   but provided for completeness.)-  deriving (Eq, Ord, Typeable, Show)+  deriving (Eq, Ord, Show)  -- | This option controls when / whether the test output file is deleted -- For example, it may be convenient to delete the output file when a test
Test/Tasty/Golden/Manage.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, PatternGuards, DeriveDataTypeable #-}+{-# LANGUAGE GeneralizedNewtypeDeriving, PatternGuards #-} -- | Previously, accepting tests (by the @--accept@ flag) was done by this -- module, and there was an ingredient to handle that mode. --
tasty-golden.cabal view
@@ -1,5 +1,6 @@+cabal-version:       2.0 name:                tasty-golden-version:             2.3.5+version:             2.3.6 synopsis:            Golden tests support for tasty description:   This package provides support for «golden testing».@@ -20,24 +21,35 @@ -- copyright: category:            Testing build-type:          Simple-cabal-version:       1.14-extra-source-files:++extra-doc-files:   CHANGELOG.md+  README.md++extra-source-files:   example/golden/fail/*.golden   example/golden/success/*.golden   tests/golden/*.golden-Tested-With:-  GHC ==7.8.4 ||-      ==7.10.3 ||-      ==8.0.2 ||-      ==8.2.2 ||-      ==8.4.4 ||-      ==8.6.5 ||-      ==8.8.2 +tested-with:+  GHC == 9.14.1+  GHC == 9.12.2+  GHC == 9.10.3+  GHC == 9.8.4+  GHC == 9.6.7+  GHC == 9.4.8+  GHC == 9.2.8+  GHC == 9.0.2+  GHC == 8.10.7+  GHC == 8.8.4+  GHC == 8.6.5+  GHC == 8.4.4+  GHC == 8.2.2+  GHC == 8.0.2+ Source-repository head   type:     git-  location: git://github.com/UnkindPartition/tasty-golden.git+  location: https://github.com/UnkindPartition/tasty-golden.git  library   Default-language:@@ -53,19 +65,16 @@   ghc-options: -Wall    build-depends:-    base >= 4.7,+    base >= 4.9 && < 5,     tasty >= 1.3,     bytestring >= 0.9.2.1,     typed-process,-    mtl,     optparse-applicative >= 0.3.1,     filepath,     temporary,-    tagged,     deepseq,     containers,     directory,-    async,     text  Test-suite test@@ -78,7 +87,7 @@   Main-is:     test.hs   Build-depends:-      base >= 4 && < 5+      base >= 4.9 && < 5     , tasty >= 1.2     , tasty-hunit     , tasty-golden@@ -88,6 +97,7 @@     , temporary   if (flag(build-example))     cpp-options: -DBUILD_EXAMPLE+    build-tool-depends: tasty-golden:example   Ghc-options: -threaded  flag build-example
tests/golden/before-accept.golden view
@@ -7,6 +7,7 @@   Failing tests     goldenVsFile:       FAIL       Files 'example/golden/fail/goldenVsFile.golden' and 'example/golden/fail/goldenVsFile.actual' differ+      Use -p '$0=="Tests.Failing tests.goldenVsFile"' to rerun this test only.     goldenVsFileDiff:   FAIL       1d0       < 1@@ -35,6 +36,7 @@       169d156       <<truncated>       Use --accept or increase --size-cutoff to see full output.+      Use -p '/Failing tests.goldenVsFileDiff/' to rerun this test only.     goldenVsString:     FAIL       Test output was different from 'example/golden/fail/goldenVsString.golden'. It was:       2@@ -87,8 +89,9 @@       55       56<truncated>       Use --accept or increase --size-cutoff to see full output.+      Use -p '$0=="Tests.Failing tests.goldenVsString"' to rerun this test only.     goldenVsStringDiff: FAIL-      Test output was different from 'example/golden/fail/goldenVsStringDiff.golden'. Output of ["diff","example/golden/fail/goldenVsStringDiff.golden","/tmp/goldenVsStringDiff.actual"]:+      Test output was different from 'example/golden/fail/goldenVsStringDiff.golden'. Output of ["diff","example/golden/fail/goldenVsStringDiff.golden","/private/var/folders/19/d9jtc4c5365g3c_5jjk7m_980000gn/T/goldenVsStringDiff.actual"]:       1d0       < 1       4d2@@ -116,5 +119,6 @@       169d156       <<truncated>       Use --accept or increase --size-cutoff to see full output.+      Use -p '/Failing tests.goldenVsStringDiff/' to rerun this test only.  4 out of 8 tests failed