?
Unknown Status unknown.
Code
// Test: Runtime Registry Dispatch
// Minimal test to verify the generated dispatcher works
~import std/runtime
const std = @import("std");
// Simple event to dispatch to
~pub tor greet { name: string }
| greeted string
~proc greet|zig {
std.debug.print("GREET CALLED with name: {s}\n", .{name});
return .{ .greeted = "Hello!" };
}
// Register just this one event
~std/runtime:register(scope: "test") {
greet
}
// Entry point - uses the dispatcher's inline types
pub fn main() void {
std.debug.print("=== DISPATCH TEST ===\n", .{});
// Create a fake invocation for "greet" using inline types
const segments = [_][]const u8{"greet"};
const path = Path{
.module_qualifier = null,
.segments = &segments,
};
var args_array = [_]Arg{
.{
.name = "name",
.value = "World",
},
};
const inv = Invocation{
.path = path,
.args = &args_array,
};
// Call the dispatcher with result output!
var result: DispatchResult = undefined;
dispatch_test(&inv, &result) catch |err| {
std.debug.print("Dispatch error: {}\n", .{err});
return;
};
// Print the result - this is what the interpreter would use!
std.debug.print("=== DISPATCH SUCCESS ===\n", .{});
std.debug.print("Branch: {s}\n", .{result.branch});
std.debug.print("Fields: {d}\n", .{result.fields.len});
}
Flows
flow ~register click a branch to expand · @labels scroll to their anchor
register (scope: "test", source: greet)
Test Configuration
MUST_RUN