Zornux docs
Get started Spec

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

AssertionPasses when…
expect value to equal expectedValues are equal.
expect value to not equal expectedValues differ.
expect value to be trueThe value is true.
expect value to be falseThe value is false.
expect value to be nothingThe value is nothing.
expect value to contain itemA list or text contains the item.
expect value to be greater than nA number is larger.
expect value to be less than nA number is smaller.
expect expression to throwThe 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).