[Tests] Add JavaAgainstKotlin tests for K2
^KT-64405 Fixed
This commit is contained in:
committed by
Space Team
parent
34877130c7
commit
29c68c8aa7
+1
-1
@@ -58,7 +58,7 @@ abstract class AbstractCompileJavaAgainstKotlinTest : TestCaseWithTmpdir() {
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
protected fun doTest(ktFilePath: String, useJavac: Boolean) {
|
||||
protected open fun doTest(ktFilePath: String, useJavac: Boolean) {
|
||||
Assert.assertTrue(ktFilePath.endsWith(".kt"))
|
||||
val ktFile = File(ktFilePath)
|
||||
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)
|
||||
Reference in New Issue
Block a user