HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduletasty-silver-3.3.2.1Haskell2010

Test.Tasty.Silver.Advanced

Contents
  1. Constructing golden tests
  2. Reading files
Synopsis

Constructing golden tests

valuegoldenTest1
  1. :: TestName

    test name

  2. -> IO (Maybe a)

    get the golden correct value

  3. -> IO a

    get the tested value

  4. -> (a -> a -> GDiff)

    comparison function.

    If two values are the same, it should return Equal. If they are different, it should return a diff representation. First argument is golden value.

  5. -> (a -> GShow)

    Show the golden/actual value.

  6. -> (a -> IO ())

    update the golden file

  7. -> TestTree

A very general testing function.

valuegoldenTestIO
  1. :: TestName

    test name

  2. -> IO (Maybe a)

    get the golden correct value

  3. -> IO a

    get the tested value

  4. -> (a -> a -> IO GDiff)

    comparison function.

    If two values are the same, it should return Equal. If they are different, it should return a diff representation. First argument is golden value.

  5. -> (a -> IO GShow)

    Show the golden/actual value.

  6. -> (a -> IO ())

    update the golden file

  7. -> TestTree

A very general testing function. The IO version of show/diff are useful when using external diff or show mechanisms. If IO is not required, the goldenTest1 function should be used instead.

valuegoldenTestIO1
  1. :: TestName

    test name

  2. -> IO (Maybe a)

    get the golden correct value

  3. -> IO a

    get the tested value

  4. -> (a -> a -> IO GDiff)

    comparison function.

    If two values are the same, it should return Equal. If they are different, it should return a diff representation. First argument is golden value.

  5. -> (a -> IO GShow)

    Show the golden/actual value.

  6. -> Maybe (a -> IO ())

    update the golden file

  7. -> TestTree

A very general testing function. Experimental function, may change in later versions! The IO version of show/diff are useful when using external diff or show mechanisms. If IO is not required, the goldenTest1 function should be used instead.

valuegoldenTest
  1. :: TestName

    test name

  2. -> IO a

    get the golden correct value

  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. Use goldenTest1 instead if you can.

Reading files