runTests
lib.runTests
Docs pulled from | This Revision | 35 minutes ago
Evaluates a set of tests.
A test is an attribute set {expr, expected}
,
denoting an expression and its expected result.
The result is a list
of failed tests, each represented as
{name, expected, result}
,
- expected
- What was passed as
expected
- What was passed as
- result
- The actual
result
of the test
- The actual
Used for regression testing of the functions in lib; see tests.nix for more examples.
Important: Only attributes that start with test
are executed.
- If you want to run only a subset of the tests add the attribute
tests = ["testName"];
Inputs
tests
-
Tests to run
Type
runTests :: {
tests = [ String ];
${testName} :: {
expr :: a;
expected :: a;
};
}
->
[
{
name :: String;
expected :: a;
result :: a;
}
]
Examples
lib.debug.runTests
usage example
runTests {
testAndOk = {
expr = lib.and true false;
expected = false;
};
testAndFail = {
expr = lib.and true false;
expected = true;
};
}
->
[
{
name = "testAndFail";
expected = true;
result = false;
}
]