✗
Failing This test is currently failing.
Failed: frontend
Failure Output
error[PARSE003]: Koru constructs in host-embedded files (`.kz`, `.kjs`, etc.) must start with `~` — the host→Koru switch
--> /Users/larsde/src/orisha/lib/routing.kz:13:1
|
13 | import std/testing
| ^
error[PARSE001]: parse error
--> tests/regression/300_ADVANCED_FEATURES/350_SUBFLOWS/350_010_orisha_router_showcase/input.kz:14:0 Code
// ============================================================================
// REGRESSION TEST - Orisha Router Showcase
// ============================================================================
// Test: Pattern-branch router transform (the core orisha routing pattern)
// Feature: orisha:router reads pattern branches like [GET /path] and generates
// inline dispatch code. Tests method matching, path matching, parameter
// extraction, and catch-all fallback.
// Verifies: Full router transform pipeline — pattern parsing, inline_body
// generation, branch name escaping, parameter extraction
// ============================================================================
~import orisha
~import std/io
const std = @import("std");
// Test request struct (matches orisha.Request)
const TestRequest = struct {
method: []const u8,
path: []const u8,
};
const req_root = TestRequest{ .method = "GET", .path = "/" };
const req_about = TestRequest{ .method = "GET", .path = "/about" };
const req_user = TestRequest{ .method = "GET", .path = "/users/42" };
const req_post = TestRequest{ .method = "POST", .path = "/" };
// Test 1: exact path match
~orisha:router(req: &req_root)
! [GET /] |> std/io:print.ln("matched GET /")
! [GET /about] |> std/io:print.ln("matched GET /about")
! [GET /users/:id] _ |> std/io:print.ln("matched user")
! [*] |> std/io:print.ln("catch-all")
// Test 2: second route match
~orisha:router(req: &req_about)
! [GET /] |> std/io:print.ln("matched GET /")
! [GET /about] |> std/io:print.ln("matched GET /about")
! [GET /users/:id] _ |> std/io:print.ln("matched user")
! [*] |> std/io:print.ln("catch-all")
// Test 3: parameter extraction from path
~orisha:router(req: &req_user)
! [GET /] |> std/io:print.ln("matched GET /")
! [GET /about] |> std/io:print.ln("matched GET /about")
! [GET /users/:id] p |> std/io:print.ln("user={{ p.id:s }}")
! [*] |> std/io:print.ln("catch-all")
// Test 4: catch-all fallback (POST doesn't match any GET route)
~orisha:router(req: &req_post)
! [GET /] |> std/io:print.ln("matched GET /")
! [GET /about] |> std/io:print.ln("matched GET /about")
! [GET /users/:id] _ |> std/io:print.ln("matched user")
! [*] |> std/io:print.ln("catch-all")
Expected output
matched GET /
matched GET /about
user=42
catch-all
Test Configuration
MUST_RUN