@@ -394,7 +394,13 @@ on TestLoadExternal pExternal
394394end TestLoadExternal
395395
396396private function __GetCaller
397- get item 1 to - 3 of line - 3 of the executionContexts
397+ local tLineNum
398+ put - 1 into tLineNum
399+ repeat while item 1 of line tLineNum of the executionContexts \
400+ is the long id of this me
401+ subtract 1 from tLineNum
402+ end repeat
403+ get item 1 to - 3 of line tLineNum of the executionContexts
398404 if there is not an it then
399405 delete item - 1 of it
400406 end if
@@ -409,23 +415,38 @@ end __StackOfObject
409415
410416-- This loads an extension whose lcb source sits in the same folder as the
411417-- current test.
412- on TestLoadAuxillaryExtension pName
413- local tBasePath , tExtraPath
414- set the itemDelimiter to slash
415- put item 1 to - 2 of the effective filename of __StackOfObject(__GetCaller()) into tBasePath
416- repeat while the last item of tBasePath is not "tests"
417- put item - 1 of tBasePath & slash before tExtraPath
418- delete the last item of tBasePath
419- end repeat
420-
421- local tModuleFile
422- put tBasePath & "/../_tests/_build/" & tExtraPath & pName & ".lcm" into tModuleFile
423-
424- load extension from data url ("binfile:" & tModuleFile)
425- if the result is not empty then
426- throw "Failed to load auxillary extension:" && the result && tModuleFile
427- end if
428- end TestLoadAuxillaryExtension
418+ on TestLoadAuxiliaryExtension pName, pResourceFolder
419+ local tBytecodeFile
420+ put TestGetBuiltBytecodeFile(pName ) into tBytecodeFile
421+ if pResourceFolder is empty then
422+ load extension from data url ("binfile:" & tBytecodeFile)
423+ else
424+ load extension from data url ("binfile:" & tBytecodeFile) \
425+ with resource path pResourceFolder
426+ end if
427+
428+ if the result is not empty then
429+ throw "Failed to load auxiliary extension:" && \
430+ the result && tBytecodeFile
431+ end if
432+ end TestLoadAuxiliaryExtension
433+
434+ constant kBytecodePathPrefix = "_tests/_build/"
435+ function TestGetBuiltBytecodeFile pName
436+ local tBasePath , tExtraPath
437+ set the itemDelimiter to slash
438+ put item 1 to - 2 of the effective filename of \
439+ __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
444+
445+ local tModuleFile
446+ put tBasePath & "/../" & kBytecodePathPrefix & tExtraPath & pName \
447+ & ".lcm" into tModuleFile
448+ return tModuleFile
449+ end TestGetBuiltBytecodeFile
429450
430451on TestLoadAllExtensions
431452 local tExtFolder
0 commit comments