✗
Failing This test is currently failing.
Failed: frontend
Failure Output
Showing last 10 of 11 lines
--> tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_064_explain_command/input.kz:9:1
|
9 | ~[comptime|explainer]pub event explain-demo {
| ^
error[PARSE003]: 'event' is not a Koru keyword - a declaration is introduced with 'tor' (e.g. 'tor jump { how-high: i32 }')
--> tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_064_explain_command/input.kz:33:1
|
33 | ~event main {}
| ^ Code
// Pins the explain-command spine: a library ships a ~[explainer] event returning
// an ExplainReport; the `explain` command discovers it, calls it, and renders the
// collected report to text / json / html. This inline explainer stands in for a
// real library explainer (std/store's lands separately) — it exercises the full
// path: annotation discovery -> struct-return gather -> the typed property catalog.
~import std/explain
~[comptime|explainer]pub event explain-demo {
program: *const Program,
allocator: __koru_std.mem.Allocator,
} -> ExplainReport
~proc explain-demo|zig {
_ = program;
_ = allocator;
return .{
.title = "demo/store",
.sections = &.{
.{
.heading = "Layout",
.entries = &.{
.{ .note = "struct-of-arrays elected for hot fields" },
.{ .property = .{ .key = "stores", .value = .{ .integer = 3 } } },
.{ .property = .{ .key = "users.layout", .value = .{ .string = "SoA" } } },
.{ .property = .{ .key = "users.listeners", .value = .{ .integer = 7 } } },
},
},
},
};
}
~event main {}
~proc main|zig {}
~main()
Flows
flow ~main click a branch to expand · @labels scroll to their anchor
main
Test Configuration
Post-validation Script:
#!/bin/bash
# The `explain` command discovers a library's ~[explainer], calls it, and renders
# the returned ExplainReport. Assert text prose + property rows, and TYPED json
# (integers stay integers, strings are quoted) — the tagged-union value payoff.
set -e
echo "=== koruc input.kz explain (text) ==="
TEXT=$(koruc input.kz explain 2>&1)
echo "$TEXT"
echo "$TEXT" | grep -q "demo/store" || { echo "FAIL: report title missing"; exit 1; }
echo "$TEXT" | grep -q "stores = 3" || { echo "FAIL: counter property missing"; exit 1; }
echo "$TEXT" | grep -q "users.layout = SoA" || { echo "FAIL: string property missing"; exit 1; }
echo "=== koruc input.kz explain json (typed) ==="
JSON=$(koruc input.kz explain json 2>&1)
echo "$JSON" | grep -q '"stores":3' || { echo "FAIL: integer not emitted as typed JSON number"; exit 1; }
echo "$JSON" | grep -q '"users.layout":"SoA"' || { echo "FAIL: string not emitted as quoted JSON"; exit 1; }
echo "=== PASS: explain renders text + typed json ==="