HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduletasty-golden-2.3.5Haskell2010

Test.Tasty.Golden.Advanced

  • 2 values

The main functions

2 declarations
valuegoldenTest
  1. :: TestName

    test name

  2. -> IO a

    get the golden correct value

    Note that this action may be followed by the update function call.

    Therefore, this action *should avoid* reading the file lazily; otherwise, the file may remain half-open and the update action will fail.

  3. -> IO a

    get the tested value

  4. -> (a -> a -> IO (Maybe String))

    comparison function.

    If two values are the same, it should return Nothing. If they are different, it should return an error that will be printed to the user. First argument is the golden value.

    The function may use IO, for example, to launch an external diff command.

  5. -> (a -> IO ())

    update the golden file

  6. -> TestTree
#

A very general testing function.

valuegoldenTest2
  1. :: TestName

    Test name

  2. -> IO a

    Get the golden correct value

    Note that this action may be followed by the update function call.

    Therefore, this action *should avoid* reading the file lazily; otherwise, the file may remain half-open and the update action will fail.

  3. -> IO a

    Get the tested value (in this case from the output file)

  4. -> (a -> a -> IO (Maybe String))

    Comparison function.

    If two values are the same, it should return Nothing. If they are different, it should return an error that will be printed to the user. First argument is the golden value.

    The function may use IO, for example, to launch an external diff command.

  5. -> (a -> IO ())

    Update the golden file

  6. -> IO ()

    Action to delete the output file

  7. -> TestTree
#

A variant of goldenTest that also provides for deleting the output file. The Internal.DeleteOuputFile option controls the circumstances in which the output file is to be deleted.