✓
Passing This code compiles and runs correctly.
Code
// Test: Taps implemented as a library transform
// This proves taps don't need special syntax - they're just metaprogramming!
const std = @import("std");
~import std/taps
// An event with an identity branch that can be tapped.
// Taps work by observing TRANSITIONS (branches), not void events!
~event hello {}
| greeted []const u8
~proc hello|zig {
std.debug.print("Hello executed\n", .{});
return .{ .greeted = "go" };
}
// A void observer event - no return needed
~event observer {}
~proc observer|zig {
std.debug.print("Observer fired!\n", .{});
}
// TAP: Observe hello -> * | greeted
// Using the library syntax instead of a special form
~tap(hello -> *)
| greeted _ |> observer()
// Execute hello - tap should fire on the greeted branch
~hello()
| greeted _ |> _
Actual
Hello executed
Observer fired!
Expected output
Hello executed
Observer fired!
Test Configuration
MUST_RUN