()
| 209 | |
| 210 | #[test] |
| 211 | fn test_gap_filling() { |
| 212 | use crate::{SourceOffset, Token}; |
| 213 | let bump = Bump::default(); |
| 214 | let mut output = BumpVec::new_in(&bump); |
| 215 | |
| 216 | { |
| 217 | let mut ordered_sink = CursorOrderedSink::new(&bump, &mut output); |
| 218 | // Create cursors with a gap, then fill the gap |
| 219 | let cursor_at_0 = Cursor::new(SourceOffset(0), Token::SPACE); // ends at 1 |
| 220 | let cursor_at_2 = Cursor::new(SourceOffset(2), Token::SPACE); // ends at 3 |
| 221 | let cursor_at_1 = Cursor::new(SourceOffset(1), Token::SPACE); // ends at 2, fills the gap |
| 222 | ordered_sink.append(cursor_at_0); |
| 223 | ordered_sink.append(cursor_at_2); |
| 224 | ordered_sink.append(cursor_at_1); |
| 225 | // Avoid flushing as they should be emitted immediately |
| 226 | } |
| 227 | assert_eq!(output.len(), 3); |
| 228 | assert_eq!(output[0].span().start(), SourceOffset(0)); |
| 229 | assert_eq!(output[1].span().start(), SourceOffset(1)); |
| 230 | assert_eq!(output[2].span().start(), SourceOffset(2)); |
| 231 | } |
| 232 | |
| 233 | #[test] |
| 234 | fn test_sequential() { |
nothing calls this directly
no test coverage detected