✓
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 {} -> []const u8
~proc hello|zig {
std.debug.print("Hello executed\n", .{});
return "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 -> *): v |> observer()
// Execute hello - tap should fire on the greeted branch
~hello()
Actual
Hello executed
Observer fired!
Expected output
Hello executed
Observer fired!
Flows
flow ~tap click a branch to expand · @labels scroll to their anchor
tap (hello -> *)
flow ~hello click a branch to expand · @labels scroll to their anchor
hello
Test Configuration
MUST_RUN