✓
Passing This code compiles and runs correctly.
Code
// PINS: a Koru bind named `c` inside an orisha:router arm must compile.
// Orisha used to declare `const c = std.c` at module scope; Zig 0.15
// forbids a local `const c` from shadowing that. The libc alias is
// `libc`, not `c`. Ward's `| cfg c` is this bind.
~import orisha
~import std/io
const raw = "GET / HTTP/1.1\r\n\r\n";
var exchange = koru_orisha.koru_pump.Exchange{ .fd = 0, .raw = raw };
~pub tor label {} -> string
~proc label|zig {
return "Ada";
}
~orisha:handler = orisha:router(req)
! [GET /] |> label(): c -> { status: 200, body: c, content_type: "text/plain" }
! [*] -> { status: 404, body: "miss", content_type: "text/plain" }
~orisha:answer(x: &exchange): a |> std/io:print.ln("{{ a.body:s }}") |> orisha:release-body(a.body, allocated: a.body_allocated)
Supporting Files
using static KoruHost;
static class KoruHost {
public const string raw = "GET / HTTP/1.1\r\n\r\n";
}
~proc label|cs {
return "Ada";
}Actual
Ada
Expected output
Ada
Flows
subflow ~handler click a branch to expand · @labels scroll to their anchor
router (req)
flow ~answer click a branch to expand · @labels scroll to their anchor
answer (x: &exchange)
Test Configuration
MUST_RUN
koru.json:
{
"name": "router_bind_c",
"version": "0.1.0",
"paths": {
"std": "../../../../../koru_std",
"orisha": "../../../../../../orisha/lib"
}
}