Skip to content

Commit 06cbf8f

Browse files
ligeeSpace Team
authored andcommitted
Scripting, tests: enable custom script tests with IR
1 parent d61cef0 commit 06cbf8f

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit3CompilerTests.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ fun generateJUnit3CompilerTests(args: Array<String>) {
108108
model("codegen/customScript", pattern = "^(.*)$")
109109
}
110110

111+
testClass<AbstractIrCustomScriptCodegenTest> {
112+
model("codegen/customScript", pattern = "^(.*)$")
113+
}
114+
111115
testClass<AbstractIrJsTextTestCase> {
112116
model("ir/irJsText", pattern = "^(.+)\\.kt(s)?\$")
113117
}

compiler/tests-gen/org/jetbrains/kotlin/codegen/IrCustomScriptCodegenTestGenerated.java

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

compiler/tests/org/jetbrains/kotlin/codegen/AbstractCustomScriptCodegenTest.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.script.loadScriptingPlugin
1212
import org.jetbrains.kotlin.scripting.compiler.plugin.configureScriptDefinitions
1313
import org.jetbrains.kotlin.test.ConfigurationKind
1414
import org.jetbrains.kotlin.test.InTextDirectivesUtils
15+
import org.jetbrains.kotlin.test.TargetBackend
1516
import org.jetbrains.kotlin.test.TestJdkKind
1617
import org.jetbrains.kotlin.utils.PathUtil
1718
import org.jetbrains.kotlin.utils.PathUtil.KOTLIN_SCRIPTING_COMMON_JAR
@@ -30,6 +31,8 @@ import kotlin.script.experimental.jvm.util.scriptCompilationClasspathFromContext
3031
abstract class AbstractCustomScriptCodegenTest : CodegenTestCase() {
3132
private lateinit var scriptDefinitions: List<String>
3233

34+
override val backend = TargetBackend.JVM_OLD
35+
3336
override fun setUp() {
3437
super.setUp()
3538

@@ -54,6 +57,11 @@ abstract class AbstractCustomScriptCodegenTest : CodegenTestCase() {
5457
throw UnsupportedOperationException("Multiple files are not yet supported in this test")
5558
}
5659

60+
if (InTextDirectivesUtils.isIgnoredTarget(backend, wholeFile)) {
61+
println("${wholeFile.name} test is skipped")
62+
return
63+
}
64+
5765
val file = files.single()
5866
val content = file.content
5967

@@ -129,6 +137,10 @@ abstract class AbstractCustomScriptCodegenTest : CodegenTestCase() {
129137
}
130138
}
131139

140+
abstract class AbstractIrCustomScriptCodegenTest : AbstractCustomScriptCodegenTest() {
141+
override val backend: TargetBackend = TargetBackend.JVM_IR
142+
}
143+
132144
object TestScriptWithReceiversConfiguration : ScriptCompilationConfiguration(
133145
{
134146
implicitReceivers(String::class)

0 commit comments

Comments
 (0)