[Tests] Add JavaAgainstKotlin tests for K2
^KT-64405 Fixed
This commit is contained in:
committed by
Space Team
parent
34877130c7
commit
29c68c8aa7
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// !IGNORE_FIR
|
||||||
|
// KT-64909
|
||||||
// !LANGUAGE: +InlineClasses
|
// !LANGUAGE: +InlineClasses
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ abstract class AbstractCompileJavaAgainstKotlinTest : TestCaseWithTmpdir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
protected fun doTest(ktFilePath: String, useJavac: Boolean) {
|
protected open fun doTest(ktFilePath: String, useJavac: Boolean) {
|
||||||
Assert.assertTrue(ktFilePath.endsWith(".kt"))
|
Assert.assertTrue(ktFilePath.endsWith(".kt"))
|
||||||
val ktFile = File(ktFilePath)
|
val ktFile = File(ktFilePath)
|
||||||
val javaFile = File(ktFilePath.replaceFirst("\\.kt$".toRegex(), ".java"))
|
val javaFile = File(ktFilePath.replaceFirst("\\.kt$".toRegex(), ".java"))
|
||||||
|
|||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.jvm.compiler
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||||
|
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||||
|
import org.jetbrains.kotlin.config.JVMConfigurationKeys
|
||||||
|
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
abstract class AbstractFirCompileJavaAgainstKotlinTest(private val useLightTree: Boolean) : AbstractCompileJavaAgainstKotlinTest() {
|
||||||
|
override fun doTest(ktFilePath: String, useJavac: Boolean) {
|
||||||
|
val ktFile = File(ktFilePath)
|
||||||
|
val directives = KotlinTestUtils.parseDirectives(ktFile.readText())
|
||||||
|
if (directives.contains("IGNORE_FIR")) return
|
||||||
|
super.doTest(ktFilePath, useJavac)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun updateConfiguration(configuration: CompilerConfiguration) {
|
||||||
|
configuration.put(JVMConfigurationKeys.IR, true)
|
||||||
|
configuration.put(CommonConfigurationKeys.USE_FIR, true)
|
||||||
|
if (useLightTree) configuration.put(CommonConfigurationKeys.USE_LIGHT_TREE, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.jvm.compiler.ir
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.jvm.compiler.AbstractFirCompileJavaAgainstKotlinTest
|
||||||
|
|
||||||
|
abstract class AbstractFirLightTreeCompileJavaAgainstKotlinTest : AbstractFirCompileJavaAgainstKotlinTest(true)
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.jvm.compiler.ir
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.jvm.compiler.AbstractFirCompileJavaAgainstKotlinTest
|
||||||
|
|
||||||
|
abstract class AbstractFirPsiCompileJavaAgainstKotlinTest : AbstractFirCompileJavaAgainstKotlinTest(false)
|
||||||
+34
-3
@@ -28,9 +28,7 @@ import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS_WITHOUT_
|
|||||||
import org.jetbrains.kotlin.integration.AbstractAntTaskTest
|
import org.jetbrains.kotlin.integration.AbstractAntTaskTest
|
||||||
import org.jetbrains.kotlin.ir.AbstractIrCfgTestCase
|
import org.jetbrains.kotlin.ir.AbstractIrCfgTestCase
|
||||||
import org.jetbrains.kotlin.jvm.compiler.*
|
import org.jetbrains.kotlin.jvm.compiler.*
|
||||||
import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrCompileJavaAgainstKotlinTest
|
import org.jetbrains.kotlin.jvm.compiler.ir.*
|
||||||
import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrCompileKotlinAgainstJavaTest
|
|
||||||
import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrLoadJavaTest
|
|
||||||
import org.jetbrains.kotlin.jvm.compiler.javac.AbstractLoadJavaUsingJavacTest
|
import org.jetbrains.kotlin.jvm.compiler.javac.AbstractLoadJavaUsingJavacTest
|
||||||
import org.jetbrains.kotlin.klib.AbstractKlibIrTextTestCase
|
import org.jetbrains.kotlin.klib.AbstractKlibIrTextTestCase
|
||||||
import org.jetbrains.kotlin.klib.AbstractKlibJsIrTextTestCase
|
import org.jetbrains.kotlin.klib.AbstractKlibJsIrTextTestCase
|
||||||
@@ -208,6 +206,8 @@ fun generateJUnit3CompilerTests(args: Array<String>, mainClassName: String?) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
testClass<AbstractCompileKotlinAgainstJavaTest> {
|
testClass<AbstractCompileKotlinAgainstJavaTest> {
|
||||||
model(
|
model(
|
||||||
"compileKotlinAgainstJava",
|
"compileKotlinAgainstJava",
|
||||||
@@ -309,6 +309,37 @@ fun generateJUnit3CompilerTests(args: Array<String>, mainClassName: String?) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testClass<AbstractFirLightTreeCompileJavaAgainstKotlinTest> {
|
||||||
|
model(
|
||||||
|
"compileJavaAgainstKotlin",
|
||||||
|
testClassName = "WithoutJavac",
|
||||||
|
testMethod = "doTestWithoutJavac",
|
||||||
|
targetBackend = TargetBackend.JVM_IR
|
||||||
|
)
|
||||||
|
model(
|
||||||
|
"compileJavaAgainstKotlin",
|
||||||
|
testClassName = "WithJavac",
|
||||||
|
testMethod = "doTestWithJavac",
|
||||||
|
targetBackend = TargetBackend.JVM_IR
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
testClass<AbstractFirPsiCompileJavaAgainstKotlinTest> {
|
||||||
|
model(
|
||||||
|
"compileJavaAgainstKotlin",
|
||||||
|
testClassName = "WithoutJavac",
|
||||||
|
testMethod = "doTestWithoutJavac",
|
||||||
|
targetBackend = TargetBackend.JVM_IR
|
||||||
|
)
|
||||||
|
model(
|
||||||
|
"compileJavaAgainstKotlin",
|
||||||
|
testClassName = "WithJavac",
|
||||||
|
testMethod = "doTestWithJavac",
|
||||||
|
targetBackend = TargetBackend.JVM_IR
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
testClass<AbstractIrCompileKotlinAgainstJavaTest> {
|
testClass<AbstractIrCompileKotlinAgainstJavaTest> {
|
||||||
model(
|
model(
|
||||||
"compileKotlinAgainstJava",
|
"compileKotlinAgainstJava",
|
||||||
|
|||||||
+1384
File diff suppressed because it is too large
Load Diff
+1384
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user