006 impure event fixed

✓ Passing This code compiles and runs correctly.

Code

// Test: Impure events with overrides work
//
// Same as 395_005 but WITH overrides provided.
// This should compile and pass.

~import "$std/testing"

// Impure event - Zig proc without ~[pure]
~event fetch_user { id: u32 }
| found { name: []const u8 }
| not_found {}

~proc fetch_user {
    // This is impure - does I/O (simulated)
    return .{ .found = .{ .name = "Alice" } };
}

// Another impure event
~event save_log { message: []const u8 }
| saved {}

~proc save_log {
    // This is impure - writes to disk
    return .{ .saved = .{} };
}

// Test: Should PASS - overrides provided for impure events
// Verify the mock value propagates through the chain
~test(Impure events with overrides work) {
    ~fetch_user = found { name: "TestUser" }
    ~save_log = saved {}

    ~fetch_user(id: 1)
    | found u |> assert(u.name.len == 8)
}

pub fn main() void {}
input.kz

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 $?