✓
Passing This code compiles and runs correctly.
Code
// Test: Pure events don't require mocks
//
// Events with ~[pure] procs can be called in tests without mocking.
// Only impure events (side effects) need mocks.
~import std/testing
// Pure computation - no side effects
~tor add-numbers { a: u32, b: u32 } -> u32
~[pure] proc add-numbers|zig {
return a + b;
}
// Test: Pure event called directly, no mock needed
// Actually verify the computation result!
~test(Pure event works without mock) {
~add-numbers(a: 5, b: 3): r |> assert(r == 8)
}
Flows
flow ~test click a branch to expand · @labels scroll to their anchor
test (Pure event works without mock, source: ~add-numbers(a: 5, b: 3): r |> assert(r == 8))
Test Configuration
Post-validation Script:
#!/bin/bash
# Run the actual Zig tests to verify pure events work without mocks
cd "$(dirname "$0")"
# Run zig test on the generated output
zig test output_emitted.zig 2>&1
exit $?