Return loop index in regex iterator.

This commit is contained in:
Jeroen van Rijn
2025-04-06 21:45:37 +02:00
parent 66077add33
commit 9a2b6c01aa
2 changed files with 15 additions and 6 deletions
@@ -1127,13 +1127,12 @@ test_match_iterator :: proc(t: ^testing.T) {
(err == nil) or_continue
count: int
for capture in regex.match(&it) {
for capture, idx in regex.match(&it) {
if count > len(test.expected) {
break
}
check_capture(t, capture, test.expected[count])
count += 1
check_capture(t, capture, test.expected[idx])
}
testing.expect_value(t, count, len(test.expected))
testing.expect_value(t, it.idx, len(test.expected))
}
}