✓
Passing This code compiles and runs correctly.
Code
// Test: Impure event with override works
//
// Pair to 395_005 (impure event without override errors).
// Verifies that the mock substitution replaces the impure
// proc body and the mocked branch value propagates through
// the binding.
~import "$std/testing"
~event fetch_user { id: u32 }
| found []const u8
~proc fetch_user {
return .{ .found = "Alice" };
}
~test(Impure event with override works) {
~fetch_user = found "TestUser"
~fetch_user(id: 1)
| found u |> assert(u.len == 8)
}
pub fn main() void {}
Test Configuration
Post-validation Script:
#!/bin/bash
# Run the actual Zig tests to verify impure events work WITH mocks
cd "$(dirname "$0")"
# Run zig test on the generated output
zig test output_emitted.zig 2>&1
exit $?