Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 93bd81a

Browse files
committed
[Bug 18463] Make compiler test runner allow chars to be converted to spaces
When checking that a compiler error message contains the correct line of source code, allow any of the original characters to be converted to spaces.
1 parent 6d6eae6 commit 93bd81a

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

tests/_compilertestrunner.livecodescript

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ private function doesCompilerOutputSatisfyAssertion pCompilerOutput, pCompilerEx
352352
put "search" into tState
353353
repeat for each line tOutputLine in pCompilerOutput
354354
local tFile, tLine, tColumn, tType, tMessage
355-
local tSourceLine, tMarker
355+
local tSourceLine, tCharOffset, tOutputChar, tMarker
356356

357357
if tState is "search" then
358358
-- The format of each output line is:
@@ -383,13 +383,21 @@ private function doesCompilerOutputSatisfyAssertion pCompilerOutput, pCompilerEx
383383

384384
else if tState is "source line" then
385385
-- The format of the source line output is a space followed
386-
-- by the corresponding line of the input source file.
387-
388-
put " " & line tLine of pTestInfo["code"] into tSourceLine
386+
-- by the corresponding line of the input source file. The
387+
-- compiler may replace any of the source characters with
388+
-- spaces (for example, to remove control characters).
389+
390+
put " " & line tLine of pTestInfo["code"] into tSourceLine
391+
392+
repeat with tCharOffset = 1 to the number of chars in tOutputLine
393+
put char tCharOffset of tOutputLine into tOutputChar
394+
if tOutputChar is not " " and \
395+
tOutputChar is not char tCharOffset of tSourceLine then
396+
return false
397+
end if
398+
end repeat
389399

390-
if tOutputLine is tSourceLine then
391-
put "marker" into tState
392-
end if
400+
put "marker" into tState
393401

394402
else if tState is "marker" then
395403
-- The marker should point at the correct column within the
@@ -402,6 +410,8 @@ private function doesCompilerOutputSatisfyAssertion pCompilerOutput, pCompilerEx
402410

403411
if tOutputLine is tMarker then
404412
return true
413+
else
414+
return false
405415
end if
406416
end if
407417
end repeat

0 commit comments

Comments
 (0)