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

  1. Split source into regions
  2. Parse #code region (with preamble)
  3. Parse #view region, merge components
  4. Parse #test region → generates __test_* functions
  5. Append test functions to the module’s function list
  6. Compile (comptime → typecheck → lower)
  7. Find and run each __test_* function via the VM
  8. Run setup before and teardown after each test (if defined)

Tests run exclusively in the VM — there is no native execution mode for tests.

Options

FlagDescription
--substitute M=pathReplace module M with file at path (dependency injection)
-I <path>Add module search path
--humanHuman-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 total

Exit codes

CodeMeaning
0All tests passed (or skipped)
1One or more tests failed, or compilation error
2Usage error (no file argument)

Test result values

Each test function returns an i64:

Return valueMeaning
0Pass
-1Fail (@assert failure or @fail)
-2Skipped (@skip condition was true)
Planned — Filter tests by name pattern to run a subset. Not yet implemented.
Plannedtape test without a file argument to discover and run all #test regions in a project. Currently requires an explicit file path.

Last modified: