Safe Haskell | None |
---|---|
Language | Haskell98 |
- goldenTest :: TestName -> (forall r. ValueGetter r a) -> (forall r. ValueGetter r a) -> (a -> a -> IO (Maybe String)) -> (a -> IO ()) -> Test
- newtype ValueGetter r a = ValueGetter {
- runValueGetter :: ContT r IO a
- vgReadFile :: FilePath -> ValueGetter r ByteString
The main function
:: 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 The function may use |
-> (a -> IO ()) | update the golden file |
-> Test |
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.
ValueGetter | |
|
Monad (ValueGetter r) | |
Functor (ValueGetter r) | |
Applicative (ValueGetter r) | |
MonadIO (ValueGetter r) | |
MonadCont (ValueGetter r) |
vgReadFile :: FilePath -> ValueGetter r ByteString Source
Lazily read a file. The file handle will be closed after the
ValueGetter
action is run.