()
| 253 | |
| 254 | #[test] |
| 255 | fn test_varied_order() { |
| 256 | use crate::{SourceOffset, Token}; |
| 257 | let bump = Bump::default(); |
| 258 | let mut output = BumpVec::new_in(&bump); |
| 259 | { |
| 260 | let mut ordered_sink = CursorOrderedSink::new(&bump, &mut output); |
| 261 | let cursor_at_4 = Cursor::new(SourceOffset(4), Token::SPACE); // ends at 5 |
| 262 | let cursor_at_0 = Cursor::new(SourceOffset(0), Token::SPACE); // ends at 1 |
| 263 | let cursor_at_6 = Cursor::new(SourceOffset(6), Token::SPACE); // ends at 7 |
| 264 | let cursor_at_2 = Cursor::new(SourceOffset(2), Token::SPACE); // ends at 3 |
| 265 | let cursor_at_1 = Cursor::new(SourceOffset(1), Token::SPACE); // ends at 2 |
| 266 | let cursor_at_3 = Cursor::new(SourceOffset(3), Token::SPACE); // ends at 4 |
| 267 | let cursor_at_5 = Cursor::new(SourceOffset(5), Token::SPACE); // ends at 6 |
| 268 | ordered_sink.append(cursor_at_4); |
| 269 | ordered_sink.append(cursor_at_0); |
| 270 | ordered_sink.append(cursor_at_6); |
| 271 | ordered_sink.append(cursor_at_2); |
| 272 | ordered_sink.append(cursor_at_1); |
| 273 | ordered_sink.append(cursor_at_3); |
| 274 | ordered_sink.append(cursor_at_5); |
| 275 | // Avoid flushing as they should be emitted immediately |
| 276 | } |
| 277 | assert_eq!(output.len(), 7); |
| 278 | for i in 0..7 { |
| 279 | assert_eq!(output[i].span().start(), SourceOffset(i as u32)); |
| 280 | } |
| 281 | } |
| 282 | } |
nothing calls this directly
no test coverage detected