@@ -73,72 +73,72 @@ def test_code_units
7373assert_equal 0 , location . start_code_units_offset ( Encoding ::UTF_16LE )
7474assert_equal 0 , location . start_code_units_offset ( Encoding ::UTF_32LE )
7575
76- assert_equal 1 , location . end_code_units_offset ( Encoding ::UTF_8 )
76+ assert_equal 4 , location . end_code_units_offset ( Encoding ::UTF_8 )
7777assert_equal 2 , location . end_code_units_offset ( Encoding ::UTF_16LE )
7878assert_equal 1 , location . end_code_units_offset ( Encoding ::UTF_32LE )
7979
8080assert_equal 0 , location . start_code_units_column ( Encoding ::UTF_8 )
8181assert_equal 0 , location . start_code_units_column ( Encoding ::UTF_16LE )
8282assert_equal 0 , location . start_code_units_column ( Encoding ::UTF_32LE )
8383
84- assert_equal 1 , location . end_code_units_column ( Encoding ::UTF_8 )
84+ assert_equal 4 , location . end_code_units_column ( Encoding ::UTF_8 )
8585assert_equal 2 , location . end_code_units_column ( Encoding ::UTF_16LE )
8686assert_equal 1 , location . end_code_units_column ( Encoding ::UTF_32LE )
8787
8888# second 😀
8989location = program . statements . body . first . arguments . arguments . first . location
9090
91- assert_equal 4 , location . start_code_units_offset ( Encoding ::UTF_8 )
91+ assert_equal 7 , location . start_code_units_offset ( Encoding ::UTF_8 )
9292assert_equal 5 , location . start_code_units_offset ( Encoding ::UTF_16LE )
9393assert_equal 4 , location . start_code_units_offset ( Encoding ::UTF_32LE )
9494
95- assert_equal 5 , location . end_code_units_offset ( Encoding ::UTF_8 )
95+ assert_equal 11 , location . end_code_units_offset ( Encoding ::UTF_8 )
9696assert_equal 7 , location . end_code_units_offset ( Encoding ::UTF_16LE )
9797assert_equal 5 , location . end_code_units_offset ( Encoding ::UTF_32LE )
9898
99- assert_equal 4 , location . start_code_units_column ( Encoding ::UTF_8 )
99+ assert_equal 7 , location . start_code_units_column ( Encoding ::UTF_8 )
100100assert_equal 5 , location . start_code_units_column ( Encoding ::UTF_16LE )
101101assert_equal 4 , location . start_code_units_column ( Encoding ::UTF_32LE )
102102
103- assert_equal 5 , location . end_code_units_column ( Encoding ::UTF_8 )
103+ assert_equal 11 , location . end_code_units_column ( Encoding ::UTF_8 )
104104assert_equal 7 , location . end_code_units_column ( Encoding ::UTF_16LE )
105105assert_equal 5 , location . end_code_units_column ( Encoding ::UTF_32LE )
106106
107107# first 😍
108108location = program . statements . body . last . name_loc
109109
110- assert_equal 6 , location . start_code_units_offset ( Encoding ::UTF_8 )
110+ assert_equal 12 , location . start_code_units_offset ( Encoding ::UTF_8 )
111111assert_equal 8 , location . start_code_units_offset ( Encoding ::UTF_16LE )
112112assert_equal 6 , location . start_code_units_offset ( Encoding ::UTF_32LE )
113113
114- assert_equal 7 , location . end_code_units_offset ( Encoding ::UTF_8 )
114+ assert_equal 16 , location . end_code_units_offset ( Encoding ::UTF_8 )
115115assert_equal 10 , location . end_code_units_offset ( Encoding ::UTF_16LE )
116116assert_equal 7 , location . end_code_units_offset ( Encoding ::UTF_32LE )
117117
118118assert_equal 0 , location . start_code_units_column ( Encoding ::UTF_8 )
119119assert_equal 0 , location . start_code_units_column ( Encoding ::UTF_16LE )
120120assert_equal 0 , location . start_code_units_column ( Encoding ::UTF_32LE )
121121
122- assert_equal 1 , location . end_code_units_column ( Encoding ::UTF_8 )
122+ assert_equal 4 , location . end_code_units_column ( Encoding ::UTF_8 )
123123assert_equal 2 , location . end_code_units_column ( Encoding ::UTF_16LE )
124124assert_equal 1 , location . end_code_units_column ( Encoding ::UTF_32LE )
125125
126126# second 😍
127127location = program . statements . body . last . value . location
128128
129- assert_equal 12 , location . start_code_units_offset ( Encoding ::UTF_8 )
129+ assert_equal 21 , location . start_code_units_offset ( Encoding ::UTF_8 )
130130assert_equal 15 , location . start_code_units_offset ( Encoding ::UTF_16LE )
131131assert_equal 12 , location . start_code_units_offset ( Encoding ::UTF_32LE )
132132
133- assert_equal 13 , location . end_code_units_offset ( Encoding ::UTF_8 )
133+ assert_equal 25 , location . end_code_units_offset ( Encoding ::UTF_8 )
134134assert_equal 17 , location . end_code_units_offset ( Encoding ::UTF_16LE )
135135assert_equal 13 , location . end_code_units_offset ( Encoding ::UTF_32LE )
136136
137- assert_equal 6 , location . start_code_units_column ( Encoding ::UTF_8 )
137+ assert_equal 9 , location . start_code_units_column ( Encoding ::UTF_8 )
138138assert_equal 7 , location . start_code_units_column ( Encoding ::UTF_16LE )
139139assert_equal 6 , location . start_code_units_column ( Encoding ::UTF_32LE )
140140
141- assert_equal 7 , location . end_code_units_column ( Encoding ::UTF_8 )
141+ assert_equal 13 , location . end_code_units_column ( Encoding ::UTF_8 )
142142assert_equal 9 , location . end_code_units_column ( Encoding ::UTF_16LE )
143143assert_equal 7 , location . end_code_units_column ( Encoding ::UTF_32LE )
144144end
@@ -157,34 +157,34 @@ def test_cached_code_units
157157assert_equal 0 , location . cached_start_code_units_offset ( utf16_cache )
158158assert_equal 0 , location . cached_start_code_units_offset ( utf32_cache )
159159
160- assert_equal 1 , location . cached_end_code_units_offset ( utf8_cache )
160+ assert_equal 4 , location . cached_end_code_units_offset ( utf8_cache )
161161assert_equal 2 , location . cached_end_code_units_offset ( utf16_cache )
162162assert_equal 1 , location . cached_end_code_units_offset ( utf32_cache )
163163
164164assert_equal 0 , location . cached_start_code_units_column ( utf8_cache )
165165assert_equal 0 , location . cached_start_code_units_column ( utf16_cache )
166166assert_equal 0 , location . cached_start_code_units_column ( utf32_cache )
167167
168- assert_equal 1 , location . cached_end_code_units_column ( utf8_cache )
168+ assert_equal 4 , location . cached_end_code_units_column ( utf8_cache )
169169assert_equal 2 , location . cached_end_code_units_column ( utf16_cache )
170170assert_equal 1 , location . cached_end_code_units_column ( utf32_cache )
171171
172172# second 😀
173173location = result . value . statements . body . first . arguments . arguments . first . location
174174
175- assert_equal 4 , location . cached_start_code_units_offset ( utf8_cache )
175+ assert_equal 7 , location . cached_start_code_units_offset ( utf8_cache )
176176assert_equal 5 , location . cached_start_code_units_offset ( utf16_cache )
177177assert_equal 4 , location . cached_start_code_units_offset ( utf32_cache )
178178
179- assert_equal 5 , location . cached_end_code_units_offset ( utf8_cache )
179+ assert_equal 11 , location . cached_end_code_units_offset ( utf8_cache )
180180assert_equal 7 , location . cached_end_code_units_offset ( utf16_cache )
181181assert_equal 5 , location . cached_end_code_units_offset ( utf32_cache )
182182
183- assert_equal 4 , location . cached_start_code_units_column ( utf8_cache )
183+ assert_equal 7 , location . cached_start_code_units_column ( utf8_cache )
184184assert_equal 5 , location . cached_start_code_units_column ( utf16_cache )
185185assert_equal 4 , location . cached_start_code_units_column ( utf32_cache )
186186
187- assert_equal 5 , location . cached_end_code_units_column ( utf8_cache )
187+ assert_equal 11 , location . cached_end_code_units_column ( utf8_cache )
188188assert_equal 7 , location . cached_end_code_units_column ( utf16_cache )
189189assert_equal 5 , location . cached_end_code_units_column ( utf32_cache )
190190end
@@ -200,7 +200,7 @@ def test_code_units_binary_valid_utf8
200200assert_equal "😀" . b . to_sym , receiver . name
201201
202202location = receiver . location
203- assert_equal 1 , location . end_code_units_column ( Encoding ::UTF_8 )
203+ assert_equal 4 , location . end_code_units_column ( Encoding ::UTF_8 )
204204assert_equal 2 , location . end_code_units_column ( Encoding ::UTF_16LE )
205205assert_equal 1 , location . end_code_units_column ( Encoding ::UTF_32LE )
206206end
0 commit comments