Reference
std/test
test and group, the two functions a .test.trb file calls, with assert doing all of the checking.
The generated reference of std/test has every public construct with its signature, its doc comment and its examples.
std/test makes a test an ordinary function call. There are no matchers: assert (from std/expression)
takes an Expression<Bool>, so a failure shows the source of the condition and the values it captured. A test fails if
it panics, and the test runner catches that per test.
Import#
use test, group from "std/test"use test from "std/test"
type Vector2 {
x: Float
y: Float
}
test "compares equal to itself" {
const v = Vector2 x: 1.0, y: 2.0
assert(v == v)
}Declarations#
test, group#
native fn test(name: String, body: () => Void)
native fn group(name: String, body: () => Void)group names a closure of test calls; test names a closure whose body is the check. Both are ordinary calls in the
.test.trb files of tests, and nest freely - a group inside a group is how a suite is organized.
Related#
- std/expression -
assert, the one function a test body calls. - The standard library - the other packages.