test: Phase 133 P0 - Promoted carrier join_id test fixture (JsonParser pattern)
This commit is contained in:
29
apps/tests/phase133_json_skip_whitespace_min.hako
Normal file
29
apps/tests/phase133_json_skip_whitespace_min.hako
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Phase 133 P0: Promoted carrier join_id test (JsonParser._skip_whitespace pattern)
|
||||||
|
// 目的: Loop + promoted carrier の join_id 問題を検証・修正(Phase 133課題)
|
||||||
|
// Issue: promoted carrier 'is_char_match' has no join_id when break is used
|
||||||
|
// Pattern: [cond_promoter] A-3 Trim pattern promoted → [phase229] no join_id error
|
||||||
|
// Input: " X" (3 spaces + character)
|
||||||
|
// Expected: return 3 (count of leading spaces before first non-space)
|
||||||
|
// Verification: exit code (VM: RC, LLVM EXE: exit code)
|
||||||
|
|
||||||
|
static box Main {
|
||||||
|
countSpaces(s) {
|
||||||
|
local count = 0
|
||||||
|
local index = 0
|
||||||
|
loop(index < s.length()) {
|
||||||
|
local char = s.substring(index, index + 1)
|
||||||
|
if char == " " {
|
||||||
|
count = count + 1
|
||||||
|
index = index + 1
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
local input = " X"
|
||||||
|
return me.countSpaces(input) // Expected: 3
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user