Language
Testing
Zornux has a built-in testing framework. Write
test blocks with expect assertions that read like
sentences, and run them with zornux test.
Writing a test
zornux
test "adds two numbers"
expect 2 + 3 to equal 5
end
test "text can be uppercased"
expect uppercase("hello") to equal "HELLO"
end
Assertions
| Assertion | Passes when… |
|---|---|
expect value to equal expected | Values are equal. |
expect value to not equal expected | Values differ. |
expect value to be true | The value is true. |
expect value to be false | The value is false. |
expect value to be nothing | The value is nothing. |
expect value to contain item | A list or text contains the item. |
expect value to be greater than n | A number is larger. |
expect value to be less than n | A number is smaller. |
expect expression to throw | The expression raises an error. |
zornux
expect length(["a", "b"]) to equal 2
expect "hello" to contain "ell"
expect 10 to be greater than 5
expect 1 / 0 to throw
Running tests
bash
zornux test # run the current project's tests
zornux test file.zx # a single file
zornux test --filter math # only tests whose name contains "math"
zornux test --json # machine-readable report
zornux test --time-limit 20000 # per-test time budget in ms (default 5000)
Per-test time limit
Each test runs under a time limit — 5000 ms by default — so a runaway test can't hang the suite. Raise it with --time-limit <ms> when a heavy determinism or parity test legitimately needs longer.
text
Running 3 tests
✓ adds two numbers
✓ text can be uppercased
✗ rejects bad input
Expected 5, but got 4.
3 tests, 2 passed, 1 failed
Isolated and consistent
Each test runs as its own fresh program, so local state never leaks between tests, while module-level declarations stay available.
Tests work across modules and packages, and run under a
security identity (--identity / --role).