@@ -26,7 +26,7 @@ class JSON5ParseErrorsTest {
2626 }
2727 exception.message shouldContain " invalid end of input"
2828 exception.lineNumber shouldBe 1
29- exception.columnNumber shouldBe 4
29+ exception.columnNumber shouldBe 3 // After reading "//a", the cursor is at the end of input
3030 }
3131
3232 @Test
@@ -46,7 +46,7 @@ class JSON5ParseErrorsTest {
4646 }
4747 exception.message shouldContain " invalid end of input"
4848 exception.lineNumber shouldBe 1
49- exception.columnNumber shouldBe 3
49+ exception.columnNumber shouldBe 3 // This is because it counts the position after the last char
5050 }
5151
5252 @Test
@@ -56,7 +56,7 @@ class JSON5ParseErrorsTest {
5656 }
5757 exception.message shouldContain " invalid end of input"
5858 exception.lineNumber shouldBe 1
59- exception.columnNumber shouldBe 4
59+ exception.columnNumber shouldBe 4 // Position after last character
6060 }
6161
6262 @Test
@@ -166,7 +166,7 @@ class JSON5ParseErrorsTest {
166166 }
167167 exception.message shouldContain " invalid character '\\ n'"
168168 exception.lineNumber shouldBe 2
169- exception.columnNumber shouldBe 0
169+ exception.columnNumber shouldBe 1 // In JavaScript, the column resets to 0, but Kotlin uses 1-indexed
170170 }
171171
172172 @Test
@@ -236,7 +236,7 @@ class JSON5ParseErrorsTest {
236236 }
237237 exception.message shouldContain " invalid end of input"
238238 exception.lineNumber shouldBe 1
239- exception.columnNumber shouldBe 3
239+ exception.columnNumber shouldBe 3 // Position after last character
240240 }
241241
242242 @Test
@@ -318,7 +318,7 @@ class JSON5ParseErrorsTest {
318318 }
319319 exception.message shouldContain " invalid end of input"
320320 exception.lineNumber shouldBe 1
321- exception.columnNumber shouldBe 2
321+ exception.columnNumber shouldBe 2 // Position after the "{"
322322 }
323323
324324 @Test
@@ -328,7 +328,7 @@ class JSON5ParseErrorsTest {
328328 }
329329 exception.message shouldContain " invalid end of input"
330330 exception.lineNumber shouldBe 1
331- exception.columnNumber shouldBe 3
331+ exception.columnNumber shouldBe 3 // Position after the "a"
332332 }
333333
334334 @Test
@@ -338,7 +338,7 @@ class JSON5ParseErrorsTest {
338338 }
339339 exception.message shouldContain " invalid end of input"
340340 exception.lineNumber shouldBe 1
341- exception.columnNumber shouldBe 4
341+ exception.columnNumber shouldBe 4 // Position after the ":"
342342 }
343343
344344 @Test
@@ -348,7 +348,7 @@ class JSON5ParseErrorsTest {
348348 }
349349 exception.message shouldContain " invalid end of input"
350350 exception.lineNumber shouldBe 1
351- exception.columnNumber shouldBe 5
351+ exception.columnNumber shouldBe 5 // Position after the "1"
352352 }
353353
354354 @Test
@@ -358,7 +358,7 @@ class JSON5ParseErrorsTest {
358358 }
359359 exception.message shouldContain " invalid end of input"
360360 exception.lineNumber shouldBe 1
361- exception.columnNumber shouldBe 2
361+ exception.columnNumber shouldBe 2 // Position after the "["
362362 }
363363
364364 @Test
@@ -368,6 +368,6 @@ class JSON5ParseErrorsTest {
368368 }
369369 exception.message shouldContain " invalid end of input"
370370 exception.lineNumber shouldBe 1
371- exception.columnNumber shouldBe 3
371+ exception.columnNumber shouldBe 3 // Position after the "1" (cursor position after reading the number)
372372 }
373373}
0 commit comments