Runs body as the subtest name, reported and filtered as test/name. Returns whether it
passed.
- t: the parent test.
- name: the subtest's name.
- body: the subtest.
run :: (t: *Test, name: string, body: (t: *Test)) -> bool
Runs body as the subtest name, reported and filtered as test/name. Returns whether it
passed.
Parameters
Returns
- bool
run :: (t: *Test, name: string, body: (t: *Test, data: *$T), data: *T) -> bool
run with data passed on to body, for table tests:
Parameters
- t: *Test
- the parent test.
- name: string
- the subtest's name.
- body: (t: *Test, data: *$T)
- the subtest, called with
data. - data: *T
- handed to
body.
Returns
- bool
Case :: struct {
name: string;
left: int;
right: int;
sum: int;
}
check_case :: (t: *Test, data: *Case) {
expect_equal(data.left + data.right, data.sum);
}
cases := Case.[.{"small", 1, 2, 3}, .{"large", 40, 2, 42}];
for cases run(t, it.name, check_case, *it);