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

Commit 87a279a

Browse files
committed
[[ Tests ]] Allow multiple occurrences of tests in test file path
This patch ensures that the first occurrence of a directory named tests in an lcb file's path is used for computing the location relative to the _tests/build folder
1 parent fd1cefc commit 87a279a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/_testlib.livecodescript

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,14 +437,16 @@ function TestGetBuiltBytecodeFile pName
437437
set the itemDelimiter to slash
438438
put item 1 to -2 of the effective filename of \
439439
__StackOfObject(__GetCaller()) into tBasePath
440-
repeat while the last item of tBasePath is not "tests"
441-
put item -1 of tBasePath & slash before tExtraPath
442-
delete the last item of tBasePath
443-
end repeat
440+
441+
local tTestsOffset
442+
set the wholematches to true
443+
put itemOffset("tests", tBasePath) into tTestsOffset
444+
put item tTestsOffset + 1 to -1 of tBasePath into tExtraPath
445+
put item 1 to tTestsOffset - 1 of tBasePath into tBasePath
444446

445447
local tModuleFile
446-
put tBasePath & "/../" & kBytecodePathPrefix & tExtraPath & pName \
447-
& ".lcm" into tModuleFile
448+
put tBasePath & "/" & kBytecodePathPrefix & tExtraPath & slash & \
449+
pName & ".lcm" into tModuleFile
448450
return tModuleFile
449451
end TestGetBuiltBytecodeFile
450452

0 commit comments

Comments
 (0)