Skip to main content

Module test_codegen

Module test_codegen 

Source
Expand description

Test block codegen — compiles PEPL tests { } blocks to WASM functions.

Each test case test "description" { ... } becomes a WASM function __test_N() that:

  1. Re-initialises state (calls init() internally)
  2. Executes the test body (action dispatches, assertions, let bindings)
  3. Returns void on success, or traps on assertion failure

The host calls __test_count() to discover how many tests exist, then __test_N() (N = 0, 1, …) to run each.

Functions§

emit_test_body
Compile a single test body into WASM instructions.
emit_test_count
Emit __test_count() -> i32.