4 (case: $test_name:ident,
6 source_file_start_pos: $source_file_start_pos:expr,
8 multi_byte_chars: $multi_byte_chars:expr,
9 non_narrow_chars: $non_narrow_chars:expr,) => {
12 let (lines, multi_byte_chars, non_narrow_chars) =
13 analyze_source_file($text, BytePos($source_file_start_pos));
15 let expected_lines: Vec<BytePos> = $lines.into_iter().map(BytePos).collect();
17 assert_eq!(lines, expected_lines);
19 let expected_mbcs: Vec<MultiByteChar> = $multi_byte_chars
21 .map(|(pos, bytes)| MultiByteChar { pos: BytePos(pos), bytes })
24 assert_eq!(multi_byte_chars, expected_mbcs);
26 let expected_nncs: Vec<NonNarrowChar> = $non_narrow_chars
28 .map(|(pos, width)| NonNarrowChar::new(BytePos(pos), width))
31 assert_eq!(non_narrow_chars, expected_nncs);
39 source_file_start_pos: 0,
41 multi_byte_chars: vec![],
42 non_narrow_chars: vec![],
48 source_file_start_pos: 0,
50 multi_byte_chars: vec![],
51 non_narrow_chars: vec![],
56 text: "012345678\nabcdef012345678\na",
57 source_file_start_pos: 0,
58 lines: vec![0, 10, 26],
59 multi_byte_chars: vec![],
60 non_narrow_chars: vec![],
64 case: newline_and_multi_byte_char_in_same_chunk,
65 text: "01234β789\nbcdef0123456789abcdef",
66 source_file_start_pos: 0,
68 multi_byte_chars: vec![(5, 2)],
69 non_narrow_chars: vec![],
73 case: newline_and_control_char_in_same_chunk,
74 text: "01234\u{07}6789\nbcdef0123456789abcdef",
75 source_file_start_pos: 0,
77 multi_byte_chars: vec![],
78 non_narrow_chars: vec![(5, 0)],
82 case: multi_byte_char_short,
84 source_file_start_pos: 0,
86 multi_byte_chars: vec![(1, 2)],
87 non_narrow_chars: vec![],
91 case: multi_byte_char_long,
92 text: "0123456789abcΔf012345β",
93 source_file_start_pos: 0,
95 multi_byte_chars: vec![(13, 2), (22, 2)],
96 non_narrow_chars: vec![],
100 case: multi_byte_char_across_chunk_boundary,
101 text: "0123456789abcdeΔ123456789abcdef01234",
102 source_file_start_pos: 0,
104 multi_byte_chars: vec![(15, 2)],
105 non_narrow_chars: vec![],
109 case: multi_byte_char_across_chunk_boundary_tail,
110 text: "0123456789abcdeΔ....",
111 source_file_start_pos: 0,
113 multi_byte_chars: vec![(15, 2)],
114 non_narrow_chars: vec![],
118 case: non_narrow_short,
120 source_file_start_pos: 0,
122 multi_byte_chars: vec![],
123 non_narrow_chars: vec![(1, 4)],
127 case: non_narrow_long,
128 text: "01\t3456789abcdef01234567\u{07}9",
129 source_file_start_pos: 0,
131 multi_byte_chars: vec![],
132 non_narrow_chars: vec![(2, 4), (24, 0)],
136 case: output_offset_all,
137 text: "01\t345\n789abcΔf01234567\u{07}9\nbcΔf",
138 source_file_start_pos: 1000,
139 lines: vec![0 + 1000, 7 + 1000, 27 + 1000],
140 multi_byte_chars: vec![(13 + 1000, 2), (29 + 1000, 2)],
141 non_narrow_chars: vec![(2 + 1000, 4), (24 + 1000, 0)],