✗
Failing This test is currently failing.
Failed: frontend
Failure Output
error[PARSE003]: 'event' is not a Koru keyword - a declaration is introduced with 'tor' (e.g. 'tor jump { how-high: i32 }')
--> /Users/larsde/src/orisha/lib/routing.kz:57:1
|
57 | ~pub event match { path: []const u8, pattern: []const u8 }
| ^ Code
// ============================================================================
// REGRESSION TEST - Nested Router (Tree-Structured Routing)
// ============================================================================
// Test: Can orisha:router be nested inside another orisha:router's catch-all?
// This is the foundation for tree-structured routing where:
// ~orisha:router(req)
// | [GET /api/health] |> response { ... }
// | [*] |> orisha:router(req) <-- nested router
// | [GET /other] |> response { ... }
// | [*] |> response { ... } <-- inner catch-all
// ============================================================================
~import orisha
~import std/io
const std = @import("std");
const TestRequest = struct {
method: []const u8,
path: []const u8,
};
// Test 1: Hits outer route
const req1 = TestRequest{ .method = "GET", .path = "/api/health" };
~orisha:router(req: &req1)
! [GET /api/health] |> std/io:print.ln("outer: /api/health")
! [*] |> orisha:router(req: &req1)
! [GET /other] |> std/io:print.ln("inner: /other")
! [*] |> std/io:print.ln("inner: catch-all")
// Test 2: Falls through to inner route
const req2 = TestRequest{ .method = "GET", .path = "/other" };
~orisha:router(req: &req2)
! [GET /api/health] |> std/io:print.ln("outer: /api/health")
! [*] |> orisha:router(req: &req2)
! [GET /other] |> std/io:print.ln("inner: /other")
! [*] |> std/io:print.ln("inner: catch-all")
// Test 3: Falls through to inner catch-all
const req3 = TestRequest{ .method = "POST", .path = "/unknown" };
~orisha:router(req: &req3)
! [GET /api/health] |> std/io:print.ln("outer: /api/health")
! [*] |> orisha:router(req: &req3)
! [GET /other] |> std/io:print.ln("inner: /other")
! [*] |> std/io:print.ln("inner: catch-all")
Expected output
outer: /api/health
inner: /other
inner: catch-all
Flows
flow ~router click a branch to expand · @labels scroll to their anchor
router (req: &req1)
flow ~router click a branch to expand · @labels scroll to their anchor
router (req: &req2)
flow ~router click a branch to expand · @labels scroll to their anchor
router (req: &req3)
Test Configuration
MUST_RUN