✓
Passing This code compiles and runs correctly.
Code
// Test 310_009: Multiple Taps on Same Event (Library Syntax)
// Validates that multiple ~tap() declarations all fire
// NOTE: Taps fire in REVERSE declaration order (last declared = first to fire)
const std = @import("std");
~import std/taps
// Event with an identity branch for the taps to observe
~event hello {}
| greeted []const u8
// Void observer events
~event tap1 {}
~event tap2 {}
~proc hello|zig {
std.debug.print("Main flow executed\n", .{});
return .{ .greeted = "go" };
}
~proc tap1|zig {
std.debug.print("First tap observed!\n", .{});
}
~proc tap2|zig {
std.debug.print("Second tap observed!\n", .{});
}
// First tap on hello
~tap(hello -> *)
| greeted _ |> tap1()
// Second tap on hello (should also fire!)
~tap(hello -> *)
| greeted _ |> tap2()
// Execute hello - should trigger both taps
~hello()
| greeted _ |> _
Actual
Main flow executed
Second tap observed!
First tap observed!
Expected output
Main flow executed
Second tap observed!
First tap observed!
Test Configuration
MUST_RUN