()
| 166 | |
| 167 | #[test] |
| 168 | fn test_manual_flush() { |
| 169 | use crate::{SourceOffset, Token}; |
| 170 | |
| 171 | let bump = Bump::default(); |
| 172 | let mut output = BumpVec::new_in(&bump); |
| 173 | { |
| 174 | let mut ordered_sink = CursorOrderedSink::new(&bump, &mut output); |
| 175 | let cursor1 = Cursor::new(SourceOffset(0), Token::SPACE); // position 0, length 1 |
| 176 | let cursor2 = Cursor::new(SourceOffset(10), Token::SPACE); // position 10, length 1 |
| 177 | let cursor3 = Cursor::new(SourceOffset(4), Token::SPACE); // position 4, length 1 |
| 178 | |
| 179 | // Append cursors in non-source-order |
| 180 | ordered_sink.append(cursor2); |
| 181 | ordered_sink.append(cursor1); |
| 182 | ordered_sink.append(cursor3); |
| 183 | ordered_sink.flush(); |
| 184 | } |
| 185 | assert_eq!(output.len(), 3); |
| 186 | assert_eq!(output[0].span().start(), SourceOffset(0)); |
| 187 | assert_eq!(output[1].span().start(), SourceOffset(4)); |
| 188 | assert_eq!(output[2].span().start(), SourceOffset(10)); |
| 189 | } |
| 190 | |
| 191 | #[test] |
| 192 | fn test_contiguous_eager_emission() { |
nothing calls this directly
no test coverage detected