✓
Passing This code compiles and runs correctly.
Code
// Test: Impure events require overrides
// MUST_ERROR: has impure events without overrides
//
// When a test calls an impure event (Zig proc without ~[pure]),
// the compiler should error and list ALL impure events at once.
//
// This is the "fix/recompile loop killer" - great UX!
~import std/testing
// Impure event - Zig proc without ~[pure]
~tor fetch-user { id: u32 } -> string
~proc fetch-user|zig {
// This is impure - does I/O (simulated)
return "Alice";
}
// Another impure event
~tor save-log { message: string }
~proc save-log|zig {
// This is impure - writes to disk
}
// Test: Should FAIL - calls impure events without overrides
~test(Impure events should error) {
~fetch-user(id: 1): u |> save-log(message: u.name)
| saved |> assert.ok()
}
Flows
flow ~test click a branch to expand · @labels scroll to their anchor
test (Impure events should error, source: ~fetch-user(id: 1): u |> save-log(message: u.name)
| saved |> assert.ok())
Test Configuration
Expected Error:
impure events without mocks