This module defines the main data types and functions needed to use Tasty.
- type TestName = String
- data TestTree
- testGroup :: TestName -> [TestTree] -> TestTree
- defaultMain :: TestTree -> IO ()
- defaultMainWithIngredients :: [Ingredient] -> TestTree -> IO ()
- defaultIngredients :: [Ingredient]
- includingOptions :: [OptionDescription] -> Ingredient
- adjustOption :: IsOption v => (v -> v) -> TestTree -> TestTree
- localOption :: IsOption v => v -> TestTree -> TestTree
- askOption :: IsOption v => (v -> TestTree) -> TestTree
- data Timeout
- mkTimeout :: Integer -> Timeout
- withResource :: IO a -> (a -> IO ()) -> (IO a -> TestTree) -> TestTree
The main data structure defining a test suite.
It consists of individual test cases and properties, organized in named groups which form a tree-like hierarchy.
There is no generic way to create a test case. Instead, every test
provider (tasty-hunit, tasty-smallcheck etc.) provides a function to
turn a test case into a
Groups can be created using
Create a named group of test cases or other groups
Parse the command line arguments and run the tests using the provided ingredient list
This ingredient doesn't do anything apart from registering additional options.
The option values can be accessed using
Adjusting and querying options
Normally options are specified on the command line. But you can also have different options for different subtrees in the same tree, using the functions below.
Note that ingredient options (number of threads, hide successes etc.) set in this way will not have any effect. This is for modifying per-test options, such as timeout, number of generated tests etc.
Locally adjust the option value for the given test subtree
Locally set the option value for the given test subtree
Customize the test tree based on the run-time options
Timeout to be applied to individual tests
|Timeout Integer String|
Sometimes several tests need to access the same resource — say, a file or a socket. We want to create or grab the resource before the tests are run, and destroy or release afterwards.
|:: IO a|
initialize the resource
|-> (a -> IO ())|
free the resource
|-> (IO a -> TestTree)|
Acquire the resource to run this test (sub)tree and release it afterwards