std/test/lib
std/test/src/lib.trb
Tests are ordinary function calls in the .test.trb files of tests:
group "Vector2" {
test "adds component-wise" {
assert(Vector2(1.0, 2.0) + Vector2(3.0, 4.0) == Vector2(4.0, 6.0))
}
}
There are no matchers. assert takes an Expression<Bool>, so a failure shows the source and the values.
A test fails if it panics; the test runner catches that per test.
fn test
native fn test(name: String, body: () => Void)
Names a closure whose body is the check. Fails if the body panics; the test runner catches that per test.
fn group
native fn group(name: String, body: () => Void)
Names a closure of test calls. Groups nest freely - a group inside a group is how a suite is organized.