tape test
Usage
bash
tape test <file.tape> [options]Examples
bash
tape test module.tape
tape test app.tape --substitute io=./mock_io.tape
tape test lib.tape -I deps/How it works
- Split source into regions
- Parse
#coderegion (with preamble) - Parse
#viewregion, merge components - Parse
#testregion → generates__test_*functions - Append test functions to the module’s function list
- Compile (comptime → typecheck → lower)
- Find and run each
__test_*function via the VM - Run
setupbefore andteardownafter each test (if defined)
Tests run exclusively in the VM — there is no native execution mode for tests.
Options
| Flag | Description |
|---|---|
--substitute M=path | Replace module M with file at path (dependency injection) |
-I <path> | Add module search path |
--human | Human-readable error output |
--max-errors <N> | Stop after N errors |
Multiple --substitute flags can be provided (up to 16).
Output
plaintext
test "addition_works" ... ok
test "string_concat" ... ok
test "division_by_zero" ... FAILED
assertion failed: result == 42
expected: 42
got: 0
test "skip_on_windows" ... skipped
results: 2 passed, 1 failed, 1 skipped, 4 totalExit codes
| Code | Meaning |
|---|---|
| 0 | All tests passed (or skipped) |
| 1 | One or more tests failed, or compilation error |
| 2 | Usage error (no file argument) |
Test result values
Each test function returns an i64:
| Return value | Meaning |
|---|---|
| 0 | Pass |
| -1 | Fail (@assert failure or @fail) |
| -2 | Skipped (@skip condition was true) |
Planned — Filter tests by name pattern to run a subset. Not yet implemented.
Planned —
tape test without a file argument to discover and run all #test regions in a project. Currently requires an explicit file path.Last modified: