001 test syntax

✓ Passing This code compiles and runs correctly.

Code

// Test: Basic test transform with mock substitution
//
// Tests that:
// 1. Mocks are substituted inline (flow pruning)
// 2. Bindings are extracted from mocked branch values
// 3. Assert can verify actual values

~import "$std/testing"

// Impure event - needs mock in tests (no proc = impure by default)
~event get_balance {}
| amount { value: u32 }

// Test: Mock value is inlined, binding extracted, value verified
~test(Mock value inlined with binding) {
    ~get_balance = amount { value: 100 }
    ~get_balance()
    | amount a |> assert(a.value == 100)
}

pub fn main() void {}
input.kz

Test Configuration

Post-validation Script:

#!/bin/bash
# Run the actual Zig tests to verify mocks work correctly

cd "$(dirname "$0")"

# Run zig test on the generated output
zig test output_emitted.zig 2>&1
exit $?