| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Tasty.Silver.Advanced
Synopsis
- goldenTest1 :: TestName -> IO (Maybe a) -> IO a -> (a -> a -> GDiff) -> (a -> GShow) -> (a -> IO ()) -> TestTree
- goldenTestIO :: TestName -> IO (Maybe a) -> IO a -> (a -> a -> IO GDiff) -> (a -> IO GShow) -> (a -> IO ()) -> TestTree
- goldenTestIO1 :: TestName -> IO (Maybe a) -> IO a -> (a -> a -> IO GDiff) -> (a -> IO GShow) -> Maybe (a -> IO ()) -> TestTree
- goldenTest :: TestName -> IO a -> IO a -> (a -> a -> IO (Maybe String)) -> (a -> IO ()) -> TestTree
- data GShow = ShowText Text
- data GDiff
- readFileMaybe :: FilePath -> IO (Maybe ByteString)
Constructing golden tests
Arguments
| :: TestName | test name |
| -> IO (Maybe a) | get the golden correct value |
| -> IO a | get the tested value |
| -> (a -> a -> GDiff) | comparison function. If two values are the same, it should return |
| -> (a -> GShow) | Show the golden/actual value. |
| -> (a -> IO ()) | update the golden file |
| -> TestTree |
A very general testing function.
Arguments
| :: TestName | test name |
| -> IO (Maybe a) | get the golden correct value |
| -> IO a | get the tested value |
| -> (a -> a -> IO GDiff) | comparison function. If two values are the same, it should return |
| -> (a -> IO GShow) | Show the golden/actual value. |
| -> (a -> IO ()) | update the golden file |
| -> 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.
Arguments
| :: TestName | test name |
| -> IO (Maybe a) | get the golden correct value |
| -> IO a | get the tested value |
| -> (a -> a -> IO GDiff) | comparison function. If two values are the same, it should return |
| -> (a -> IO GShow) | Show the golden/actual value. |
| -> Maybe (a -> IO ()) | update the golden file |
| -> 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.
Arguments
| :: TestName | test name |
| -> IO a | get the golden correct value |
| -> IO 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 |
| -> TestTree |
A very general testing function. Use goldenTest1 instead if you can.
The comparison/diff result.
Reading files
readFileMaybe :: FilePath -> IO (Maybe ByteString) Source #
Read the file if it exists, else return Nothing.
Useful for reading golden files.