tasty-golden-2.0.1: Golden tests support for tasty

Safe HaskellNone

Test.Tasty.Golden.Advanced

Contents

Synopsis

The main function

goldenTestSource

Arguments

:: TestName

test name

-> (forall r. ValueGetter r a)

get the golden correct value

-> (forall r. ValueGetter r a)

get the tested value

-> (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.

-> (a -> IO ())

update the golden file

-> TestTree 

A very general testing function.

ValueGetter monad

newtype ValueGetter r a Source

An action that yields a value (either golden or tested).

CPS allows closing the file handle when using lazy IO to read data.

Constructors

ValueGetter 

Fields

runValueGetter :: ContT r IO a
 

vgReadFile :: FilePath -> ValueGetter r ByteStringSource

Lazily read a file. The file handle will be closed after the ValueGetter action is run.