JVM_IR: Enable loadJava tests

This commit is contained in:
Mads Ager
2019-05-27 14:25:20 +02:00
committed by Alexander Udalov
parent 65f06454be
commit 5be0bd4a56
15 changed files with 5175 additions and 0 deletions
@@ -1,3 +1,4 @@
// IGNORE_BACKEND: JVM_IR
//ALLOW_AST_ACCESS
package test
@@ -1,4 +1,5 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
package test
annotation class Ann
@@ -1,4 +1,5 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
@file:Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
package test
@@ -1,3 +1,4 @@
// IGNORE_BACKEND: JVM_IR
package test
annotation class Anno
@@ -1,3 +1,4 @@
// IGNORE_BACKEND: JVM_IR
package test
annotation class Anno
@@ -1,3 +1,4 @@
// IGNORE_BACKEND: JVM_IR
package test
annotation class A(val value: String)
@@ -1,3 +1,4 @@
// IGNORE_BACKEND: JVM_IR
package test
interface T {
@@ -1,3 +1,4 @@
// IGNORE_BACKEND: JVM_IR
//ALLOW_AST_ACCESS
package test
@@ -1,3 +1,4 @@
// IGNORE_BACKEND: JVM_IR
//ALLOW_AST_ACCESS
package test
@@ -1,4 +1,5 @@
// !LANGUAGE: -NoConstantValueAttributeForNonConstVals
// IGNORE_BACKEND: JVM_IR
//ALLOW_AST_ACCESS
package test
@@ -1,3 +1,4 @@
// IGNORE_BACKEND: JVM_IR
//ALLOW_AST_ACCESS
package test
@@ -121,6 +121,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
File txtFile = getTxtFileFromKtFile(ktFileName);
CompilerConfiguration configuration = newConfiguration(configurationKind, TestJdkKind.MOCK_JDK, getClasspath(), Collections.emptyList());
updateConfiguration(configuration);
if (useTypeTableInSerializer) {
configuration.put(JVMConfigurationKeys.USE_TYPE_TABLE, true);
}
@@ -189,6 +190,8 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
protected void configureEnvironment(KotlinCoreEnvironment environment) {}
protected void updateConfiguration(CompilerConfiguration configuration) {}
protected void doTestJavaAgainstKotlin(String expectedFileName) throws Exception {
File expectedFile = new File(expectedFileName);
File sourcesDir = new File(expectedFileName.replaceFirst("\\.txt$", ""));
@@ -196,6 +199,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
FileUtil.copyDir(sourcesDir, new File(tmpdir, "test"), pathname -> pathname.getName().endsWith(".java"));
CompilerConfiguration configuration = KotlinTestUtils.newConfiguration(ConfigurationKind.JDK_ONLY, getJdkKind());
updateConfiguration(configuration);
ContentRootsKt.addKotlinSourceRoot(configuration, sourcesDir.getAbsolutePath());
JvmContentRootsKt.addJavaSourceRoot(configuration, new File("compiler/testData/loadJava/include"));
JvmContentRootsKt.addJavaSourceRoot(configuration, tmpdir);
@@ -0,0 +1,14 @@
/*
* Copyright 2010-2019 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.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.jvm.compiler.AbstractLoadJavaWithFastClassReadingTest
abstract class AbstractIrLoadJavaTest : AbstractLoadJavaWithFastClassReadingTest() {
override fun updateConfiguration(configuration: CompilerConfiguration) = configuration.put(JVMConfigurationKeys.IR, true)
}
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.ir.AbstractIrSourceRangesTestCase
import org.jetbrains.kotlin.ir.AbstractIrTextTestCase
import org.jetbrains.kotlin.jvm.compiler.*
import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrCompileJavaAgainstKotlinTest
import org.jetbrains.kotlin.jvm.compiler.ir.AbstractIrLoadJavaTest
import org.jetbrains.kotlin.jvm.compiler.javac.AbstractLoadJavaUsingJavacTest
import org.jetbrains.kotlin.lexer.kdoc.AbstractKDocLexerTest
import org.jetbrains.kotlin.lexer.kotlin.AbstractKotlinLexerTest
@@ -383,6 +384,38 @@ fun main(args: Array<String>) {
model("writeFlags", targetBackend = TargetBackend.JVM_IR)
}
testClass<AbstractIrLoadJavaTest> {
model("loadJava/compiledJava", extension = "java", testMethod = "doTestCompiledJava", targetBackend = TargetBackend.JVM_IR)
model(
"loadJava/compiledJavaAndKotlin",
extension = "txt",
testMethod = "doTestCompiledJavaAndKotlin",
targetBackend = TargetBackend.JVM_IR
)
model(
"loadJava/compiledJavaIncludeObjectMethods",
extension = "java",
testMethod = "doTestCompiledJavaIncludeObjectMethods",
targetBackend = TargetBackend.JVM_IR
)
model("loadJava/compiledKotlin", testMethod = "doTestCompiledKotlin", targetBackend = TargetBackend.JVM_IR)
model("loadJava/compiledKotlinWithStdlib", testMethod = "doTestCompiledKotlinWithStdlib", targetBackend = TargetBackend.JVM_IR)
model(
"loadJava/javaAgainstKotlin",
extension = "txt",
testMethod = "doTestJavaAgainstKotlin",
targetBackend = TargetBackend.JVM_IR
)
model(
"loadJava/kotlinAgainstCompiledJavaWithKotlin",
extension = "kt",
testMethod = "doTestKotlinAgainstCompiledJavaWithKotlin",
recursive = false,
targetBackend = TargetBackend.JVM_IR
)
model("loadJava/sourceJava", extension = "java", testMethod = "doTestSourceJava", targetBackend = TargetBackend.JVM_IR)
}
testClass<AbstractIrLineNumberTest> {
model("lineNumber", targetBackend = TargetBackend.JVM_IR)
}
File diff suppressed because it is too large Load Diff