tasty-kat-0.0.3: Known Answer Tests (KAT) framework for tasty

License | MIT
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | Good
Safe Haskell | None
Language | Haskell2010

Test.Tasty.KAT

Contents

- Run tests
- Load KAT resources

Description

Tasty support for KAT (Known Answer Tests)

Synopsis

- testKatDetailed :: TestName -> Resource a -> (String -> a -> IO Bool) -> TestTree
- testKatGrouped :: TestName -> Resource a -> (String -> a -> IO Bool) -> TestTree
- testKatLoad :: FilePath -> ([String] -> [(String, [a])]) -> IO (Resource a)
- newtype Resource a = Resource [(String, [a])]
- katLoaderSimple :: [String] -> TestResource (String, String)
- mapTestUnits :: (TestUnit (String, a) -> TestUnit b) -> TestResource (String, a) -> TestResource b

# Run tests

testKatDetailed :: TestName -> Resource a -> (String -> a -> IO Bool) -> TestTree Source #

run one tasty test per vectors in each groups

This is useful to have detailed output on what failed and what succeeded. For a more concise output, use `testKatGrouped`

testKatGrouped :: TestName -> Resource a -> (String -> a -> IO Bool) -> TestTree Source #

run one tasty test per group

# Load KAT resources

testKatLoad :: FilePath -> ([String] -> [(String, [a])]) -> IO (Resource a) Source #

Read a KAT file into values that will be used for KATs tests

newtype Resource a Source #

Constructors

Resource [(String, [a])] |

katLoaderSimple :: [String] -> TestResource (String, String) Source #

From a simple KAT file, extract

- lines starting by #, are assumed to be comment

format should be the following:

    skipped ..
    skipped ..
    [group1]

    f1= v1
    f2= v2
    ...

    f1= v3
    f2= v4
    ...

    [group2]
    ...

mapTestUnits :: (TestUnit (String, a) -> TestUnit b) -> TestResource (String, a) -> TestResource b Source #