32 · Testing
Human-readable tests
A test declaration uses a quoted human title and the existing test runner. Discovery, filtering, reports and editor navigation keep that title. Existing test attributes and suites remain available. Running the file normally does not execute its tests: use zolo test.
On this page
A test declaration uses a quoted human title and the existing test runner. Discovery, filtering, reports and editor navigation keep that title. Existing test attributes and suites remain available. Running the file normally does not execute its tests: use zolo test.
Complete example
Run this example with zolo test locally, or use the test button in the browser playground. Ordinary Run does not execute test declarations.
Run tests in the browser playground
Human-readable tests.
fn total(values: [int]) -> int {
var sum = 0
for value in values { sum += value }
return sum
}
@test(tag: "cart")
test "empty cart has zero total" { assert_eq(total([]), 0) }
@suite("cart suite")
mod cart {
test "empty cart" { assert_eq(0, 0) }
@test(skip: "example of existing attributes")
test "pending cart rule" { assert_eq(1, 1) }
}
fn main() { print("run preserves ordinary test behavior") }
Requires the Zolo CLI/host — open in the playground or run locally.
Rules and behavior
Deriving and named tests · Documentation
From a checkout of the repository:
zolo test examples/features/titled_tests.zolo
See also