tasty-expected-failure-0.12.3: Mark tasty tests as failure expected

Safe Haskell | None
Language | Haskell2010

Test.Tasty.ExpectedFailure

Synopsis

- expectFail :: TestTree -> TestTree
- expectFailBecause :: String -> TestTree -> TestTree
- ignoreTest :: TestTree -> TestTree
- ignoreTestBecause :: String -> TestTree -> TestTree
- wrapTest :: (IO Result -> IO Result) -> TestTree -> TestTree

# Documentation

expectFail :: TestTree -> TestTree Source #

Marks all tests in the given test suite as expected failures: The tests will still be run, but if they succeed, it is reported as a test suite failure, and conversely a the failure of the test is ignored.

Any output of a failing test is still printed.

This is useful if, in a test driven development, tests are written and commited to the master branch before their implementation: It allows the tests to fail (as expected) without making the whole test suite fail.

Similarly, regressions and bugs can be documented in the test suite this way, until a fix is commited, and if a fix is applied (intentionally or accidentially), the test suite will remind you to remove the `expectFail` marker.

expectFailBecause :: String -> TestTree -> TestTree Source #

Like `expectFail` but with additional comment

ignoreTest :: TestTree -> TestTree Source #

Prevents the tests from running and reports them as succeeding.

This may be be desireable as an alternative to commenting out the tests. This way, they are still typechecked (preventing bitrot), and the test report lists them, which serves as a reminder that there are ignored tests.

Note that any setup/teardown actions executed by `withResource` are still executed. You can bypass this manually as in the following example:

    askOption $ \(MyFlag b) -> if b
                               then withResource mytest
                               else ignoreTest . mytest $ return junkvalue

ignoreTestBecause :: String -> TestTree -> TestTree Source #

Like `ignoreTest` but with additional comment

wrapTest :: (IO Result -> IO Result) -> TestTree -> TestTree Source #

`wrapTest` allows you to modify the behaviour of the tests, e.g. by modifying the result or not running the test at all. It is used to implement `expectFail` and `ignoreTest`.