✓
Passing This code compiles and runs correctly.
Code
// Test: Labeled loop with tap observing transitions
//
// Tests that taps work correctly with labeled loops.
const std = @import("std");
~import std/taps
~tor counter { n: i32 }
| next i32
| done i32
~proc counter|zig {
if (n < 3) {
return .{ .next = n + 1 };
}
return .{ .done = n };
}
~tor log-iteration { value: i32 }
~proc log-iteration|zig {
std.debug.print("Iteration: {}\n", .{value});
}
// Tap that fires on counter transitions
~tap(counter -> *)
| next v |> log-iteration(value: v)
~tor start {}
~proc start|zig {
}
// Loop with tap - must handle all branches
~start() |> #loop counter(n: 1)
| next v |> @loop(n: v)
| done _ |> _
Actual
Iteration: 2
Iteration: 3
Expected output
Iteration: 2
Iteration: 3
Flows
flow ~tap click a branch to expand · @labels scroll to their anchor
tap (counter -> *)
flow ~start click a branch to expand · @labels scroll to their anchor
start
Test Configuration
MUST_RUN