Skip to content

Commit

Permalink
Scripting, tests: enable custom script tests with IR
Browse files Browse the repository at this point in the history
  • Loading branch information
ligee authored and qodana-bot committed Dec 12, 2022
1 parent d61cef0 commit 06cbf8f
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ fun generateJUnit3CompilerTests(args: Array<String>) {
model("codegen/customScript", pattern = "^(.*)$")
}

testClass<AbstractIrCustomScriptCodegenTest> {
model("codegen/customScript", pattern = "^(.*)$")
}

testClass<AbstractIrJsTextTestCase> {
model("ir/irJsText", pattern = "^(.+)\\.kt(s)?\$")
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.script.loadScriptingPlugin
import org.jetbrains.kotlin.scripting.compiler.plugin.configureScriptDefinitions
import org.jetbrains.kotlin.test.ConfigurationKind
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.utils.PathUtil
import org.jetbrains.kotlin.utils.PathUtil.KOTLIN_SCRIPTING_COMMON_JAR
Expand All @@ -30,6 +31,8 @@ import kotlin.script.experimental.jvm.util.scriptCompilationClasspathFromContext
abstract class AbstractCustomScriptCodegenTest : CodegenTestCase() {
private lateinit var scriptDefinitions: List<String>

override val backend = TargetBackend.JVM_OLD

override fun setUp() {
super.setUp()

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

if (InTextDirectivesUtils.isIgnoredTarget(backend, wholeFile)) {
println("${wholeFile.name} test is skipped")
return
}

val file = files.single()
val content = file.content

Expand Down Expand Up @@ -129,6 +137,10 @@ abstract class AbstractCustomScriptCodegenTest : CodegenTestCase() {
}
}

abstract class AbstractIrCustomScriptCodegenTest : AbstractCustomScriptCodegenTest() {
override val backend: TargetBackend = TargetBackend.JVM_IR
}

object TestScriptWithReceiversConfiguration : ScriptCompilationConfiguration(
{
implicitReceivers(String::class)
Expand Down

0 comments on commit 06cbf8f

Please sign in to comment.