Skip to content

ard/testing

The ard/testing module provides a small set of helpers for test fn declarations. Each helper returns Void!Str, so tests can use try to stop at the first failure.

use ard/testing
test fn arithmetic() Void!Str {
try testing::assert(1 + 1 == 2, "addition should work")
testing::pass()
}

Return a successful test result.

use ard/testing
test fn example() Void!Str {
testing::pass()
}

Return a failed test result with message.

use ard/testing
test fn example() Void!Str {
testing::fail("expected a value")
}

assert(condition: Bool, message: Str) Void!Str

Section titled “assert(condition: Bool, message: Str) Void!Str”

Return success when condition is true, otherwise fail with message.

use ard/testing
test fn example() Void!Str {
try testing::assert("hello".size() == 5, "string size should be 5")
testing::pass()
}