Files
hakorune/apps/tests/phase133_json_skip_whitespace_min.hako

30 lines
898 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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
}
}