✓
Passing Passing: the compiler rejects this program as expected.
Code
// ============================================================================
// TEST: Pattern Branches Parser Support
// ============================================================================
// Verifies that the parser correctly handles [...] pattern branch syntax.
// Pattern branches allow opaque expressions as branch names for DSL transforms.
//
// The [...] content is passed through as the branch name - transforms interpret it.
// ============================================================================
// Simple event to test pattern branches
~tor test-patterns {}
~proc test-patterns|zig {
}
// Test that pattern branches parse correctly
// The branch names are [GET /users/:id] etc - opaque to the compiler
~test-patterns()
| [GET /users/:id] => ok
| [POST /users] => ok
| [nested [brackets] work] => ok
| [* -> stopped] => ok // State machine style
// Verify nested patterns work
~test-patterns()
| [/admin/*] |> test-patterns()
| [GET /dashboard] => ok
Actual compiler output
error[KORU021]: tor 'test-patterns' has no branch 'GET /users/:id' (available: (none))
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_052_pattern_branches/input.kz:19:1
|
19 | | [GET /users/:id] => ok
| ^
error[KORU021]: tor 'test-patterns' has no branch 'POST /users' (available: (none))
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_052_pattern_branches/input.kz:20:1
|
20 | | [POST /users] => ok
| ^
error[KORU021]: tor 'test-patterns' has no branch 'nested [brackets] work' (available: (none))
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_052_pattern_branches/input.kz:21:1
|
21 | | [nested [brackets] work] => ok
| ^
error[KORU021]: tor 'test-patterns' has no branch '* -> stopped' (available: (none))
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_052_pattern_branches/input.kz:22:1
|
22 | | [* -> stopped] => ok // State machine style
| ^
error[KORU021]: tor 'test-patterns' has no branch '/admin/*' (available: (none))
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_052_pattern_branches/input.kz:26:1
|
26 | | [/admin/*] |> test-patterns()
| ^
error[KORU021]: tor 'test-patterns' has no branch 'GET /dashboard' (available: (none))
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_052_pattern_branches/input.kz:27:5
|
27 | | [GET /dashboard] => ok
| ^Frontend must reject with:
CONTAINS no branch 'GET /users/:id'Flows
flow ~test-patterns click a branch to expand · @labels scroll to their anchor
test-patterns
flow ~test-patterns click a branch to expand · @labels scroll to their anchor
test-patterns
Test Configuration
MUST_ERROR