test(expression, failureMessage)
test :: (expression : bool, failureMessage : string)
Evaluates an expression. Currently accepts a boolean. In the future,
any expression type will be accepted - lambdas, values, etc. On pass,
increments passCount silently. On failure, increments failCount and
prints the failure message in red along with the current section name.
TODO:
The expression argument will accept any expression type:
test(true == false, "This should fail"); test({ x = 4; }, "This should not fail"); test(bool(){ return false; }, "This should fail"); test(bool(){ return true; }, "This should not fail");
Arguments
expression
bool
The expression to evaluate
failureMessage
string
The message to display if the test fails
printSummary()
printSummary :: ()
Prints a pass/fail summary of all test() calls so far. Exits the process with code 1 if any tests failed, 0 if all passed.