Scripting: fix string script source location

fixes proper script definition discovery for expressions and other
scripts created from a string.
This commit is contained in:
Ilya Chernikov
2023-07-07 12:48:05 +02:00
committed by Space Team
parent f420b6c709
commit 0d7a5c6b1b
2 changed files with 4 additions and 12 deletions
@@ -71,28 +71,20 @@ class ScriptingWithCliCompilerTest {
runWithK2JVMCompiler(
arrayOf(
"-cp", getMainKtsClassPath().joinToString(File.pathSeparator),
"-expression",
"\\@file:CompilerOptions(\"-Xunknown1\")"
"-expression=@file:CompilerOptions(\"-Xunknown1\")"
),
expectedExitCode = 1,
expectedSomeErrPatterns = listOf(
"unresolved reference: CompilerOptions"
)
)
// it seems not possible to make a one-liner with the annotation, and
// annotation is the easiest available distinguishing factor for the .main.kts script
// so, considering "expecting an element" error as a success here
runWithK2JVMCompiler(
arrayOf(
"-cp", getMainKtsClassPath().joinToString(File.pathSeparator),
"-Xdefault-script-extension=.main.kts",
"-expression",
"\\@file:CompilerOptions(\"-Xunknown1\")"
"-expression=@file:CompilerOptions(\"-Xunknown1\")"
),
expectedExitCode = 1,
expectedSomeErrPatterns = listOf(
"expecting an element"
)
expectedExitCode = 0,
)
}