()
| 271 | /// counting the line's characters gives. |
| 272 | #[test] |
| 273 | fn utf16_cols_match_counting() { |
| 274 | let src = "plain ascii\naé😀b — ü\n\n日本語 x 😀😀\nlast"; |
| 275 | let starts = line_starts(src); |
| 276 | for (row, &start) in starts.iter().enumerate() { |
| 277 | let end = starts.get(row + 1).map_or(src.len(), |next| next - 1); |
| 278 | for (offset, _) in src[start..end].char_indices().chain([(end - start, ' ')]) { |
| 279 | let counted = utf16_len(&src[start..start + offset]) as u32; |
| 280 | assert_eq!(col16(src, &starts, row, start + offset), counted, "row {row} offset {offset}"); |
| 281 | } |
| 282 | } |
| 283 | // Before a line's start, or on a row the source does not have: 0, and the offset itself. |
| 284 | assert_eq!(col16(src, &starts, 1, 3), 0); |
| 285 | assert_eq!(col16("abc", &line_starts("abc"), 9, 2), 2); |
| 286 | } |
| 287 | |
| 288 | #[test] |
| 289 | fn init_sig_short_and_long() { |
nothing calls this directly
no test coverage detected