Skip to content

Commit 60c9a1c

Browse files
committed
[ fix ] Attempt to fix the test case related to issue #250 on Windows
1 parent b63f634 commit 60c9a1c

File tree

8 files changed

+110
-315
lines changed

8 files changed

+110
-315
lines changed

lib/js/src/Agda.bs.js

Lines changed: 10 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/src/Goals.bs.js

Lines changed: 19 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/src/State/State__Response.bs.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/test/tests/Test__Goals.bs.js

Lines changed: 14 additions & 106 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Agda.res

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,6 @@ module OffsetConverter: OffsetConverter = {
269269
// length in code units (16 bits), not the actual code point length
270270
let lengthInCodeUnits = String.length(text)
271271

272-
Js.log("=== computeUTF16SurrogatePairIndices DEBUG START ===")
273-
Js.log("Text to process:")
274-
Js.log(text)
275-
Js.log("Text length in code units: " ++ Int.toString(lengthInCodeUnits))
276272

277273
// iterate through the text to find surrogate pairs
278274
let i = ref(0)
@@ -284,13 +280,9 @@ module OffsetConverter: OffsetConverter = {
284280
if charCode >= 0xD800 && (charCode <= 0xDBFF && notFinal) {
285281
// found the high surrogate, proceed to check the low surrogate
286282
let nextCharCode = text->String.charCodeAt(i.contents + 1)->int_of_float
287-
Js.log(`High surrogate found at index ${Int.toString(i.contents)}: charCode=${Int.toString(charCode)}, nextCharCode=${Int.toString(nextCharCode)}`)
288283
if nextCharCode >= 0xDC00 && nextCharCode <= 0xDFFF {
289284
// store the index of this surrogate pair
290285
surrogatePairs->Array.push(i.contents)
291-
Js.log(`Valid surrogate pair found at index ${Int.toString(i.contents)}`)
292-
} else {
293-
Js.log(`Invalid low surrogate: nextCharCode=${Int.toString(nextCharCode)} (expected 0xDC00-0xDFFF)`)
294286
}
295287
// increment by 2 because we have checked the presumably low surrogate char
296288
i := i.contents + 2
@@ -299,9 +291,6 @@ module OffsetConverter: OffsetConverter = {
299291
}
300292
}
301293

302-
Js.log("Final surrogate pairs array:")
303-
Js.log(surrogatePairs)
304-
Js.log("=== computeUTF16SurrogatePairIndices DEBUG END ===")
305294
surrogatePairs
306295
}
307296

@@ -335,34 +324,26 @@ module OffsetConverter: OffsetConverter = {
335324
let crlfIndices = computeCRLFIndices(text)
336325

337326
Js.log("=== OffsetConverter.make DEBUG ===")
338-
Js.log("Creating OffsetConverter for text:")
339-
Js.log(text)
340-
Js.log("Surrogate pair indices:")
341-
Js.log(surrogatePairIndices)
342-
Js.log("CRLF indices:")
343-
Js.log(crlfIndices)
327+
Js.log(`Surrogate pair count: ${Int.toString(Array.length(surrogatePairIndices))}`)
328+
Js.log(`CRLF count: ${Int.toString(Array.length(crlfIndices))}`)
344329

345330
let result = {
346331
utf16indices: Indices.make(surrogatePairIndices),
347332
eolIndices: Indices.make(crlfIndices),
348333
}
349334

350-
Js.log("Created OffsetConverter")
351335
result
352336
}
353337

354338
let convert = (self, offset) => {
355-
Js.log(`=== OffsetConverter.convert DEBUG ===`)
356-
Js.log(`Input offset: ${Int.toString(offset)}`)
357-
358339
// code point -> code unit
359-
let offset = Indices.convert(self.utf16indices, offset)
360-
Js.log(`After UTF-16 conversion: ${Int.toString(offset)}`)
361-
340+
let afterUtf16 = Indices.convert(self.utf16indices, offset)
362341
// LF -> CRLF
363-
let finalOffset = Indices.convert(self.eolIndices, offset)
364-
Js.log(`After CRLF conversion: ${Int.toString(finalOffset)}`)
342+
let final = Indices.convert(self.eolIndices, afterUtf16)
343+
344+
// Log ALL offset conversions for complete debugging
345+
Js.log(`CONVERT: ${Int.toString(offset)} → UTF-16: ${Int.toString(afterUtf16)} → CRLF: ${Int.toString(final)}`)
365346

366-
finalOffset
347+
final
367348
}
368349
}

0 commit comments

Comments
 (0)