lane-av1refusalspan: a spinning scanner arm must fail the suite, not hang it
Browse files at this commitba38593f5bf3007a88577adacddf6ed3004e9d63Parent: cc885c21 changed file +8 -0
crates/ec-av1/src/refusal_inventory.rsmodified+8 -0
| @@ -2257,7 +2257,15 @@ mod tests { | |||
| 2257 | let mut i = gate_at; | 2257 | let mut i = gate_at; |
| 2258 | let mut depth = 0usize; | 2258 | let mut depth = 0usize; |
| 2259 | let mut open = None; | 2259 | let mut open = None; |
| 2260 | + let mut last: Option<usize> = None; | ||
| 2260 | while i < b.len() { | 2261 | while i < b.len() { |
| 2262 | + // Every arm advances `i`, including the ones that `continue`. A spin | ||
| 2263 | + // here would hang the suite instead of failing it, which is the one | ||
| 2264 | + // outcome a boundary finder must never have. | ||
| 2265 | + if let Some(last) = last { | ||
| 2266 | + debug_assert!(i > last, "body_braces: an arm must advance the cursor"); | ||
| 2267 | + } | ||
| 2268 | + last = Some(i); | ||
| 2261 | match b[i] { | 2269 | match b[i] { |
| 2262 | b'/' if b.get(i + 1) == Some(&b'/') => { | 2270 | b'/' if b.get(i + 1) == Some(&b'/') => { |
| 2263 | i = src[i..].find('\n').map_or(b.len(), |n| i + n + 1); | 2271 | i = src[i..].find('\n').map_or(b.len(), |n| i + n + 1); |