JVM_IR box tests for JDK9

This commit is contained in:
Dmitry Petrov
2020-12-22 11:43:04 +03:00
parent c9d330207b
commit 796d821776
5 changed files with 108 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
fun box(): String {
val f = {}
val sam = Runnable(f)
val samJavaClass = sam::class.java
if (samJavaClass.simpleName != "")
throw Exception("samJavaClass.simpleName='${samJavaClass.simpleName}'")
if (!samJavaClass.isAnonymousClass())
throw Exception("!samJavaClass.isAnonymousClass(): '${samJavaClass.name}'")
return "OK"
}
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.TestJdkKind
import org.jetbrains.kotlin.test.util.KtTestUtil
import java.io.File
@@ -14,3 +15,8 @@ abstract class AbstractJdk9BlackBoxCodegenTest : AbstractCustomJDKBlackBoxCodege
override fun getJdkHome(): File = KtTestUtil.getJdk9Home()
override fun getPrefix(): String = "java9/box"
}
abstract class AbstractJdk9IrBlackBoxCodegenTest : AbstractJdk9BlackBoxCodegenTest() {
override val backend: TargetBackend
get() = TargetBackend.JVM_IR
}
@@ -153,6 +153,10 @@ fun generateJUnit3CompilerTests(args: Array<String>) {
model("codegen/java9/box")
}
testClass<AbstractJdk9IrBlackBoxCodegenTest> {
model("codegen/java9/box", targetBackend = TargetBackend.JVM_IR)
}
testClass<AbstractScriptCodegenTest> {
model("codegen/script", extension = "kts")
}
@@ -64,6 +64,11 @@ public class Jdk9BlackBoxCodegenTestGenerated extends AbstractJdk9BlackBoxCodege
runTest("compiler/testData/codegen/java9/box/concatDynamicWithInline.kt");
}
@TestMetadata("kt36984.kt")
public void testKt36984() throws Exception {
runTest("compiler/testData/codegen/java9/box/kt36984.kt");
}
@TestMetadata("varHandle.kt")
public void testVarHandle() throws Exception {
runTest("compiler/testData/codegen/java9/box/varHandle.kt");
@@ -0,0 +1,77 @@
/*
* Copyright 2010-2020 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.codegen;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/java9/box")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class Jdk9IrBlackBoxCodegenTestGenerated extends AbstractJdk9IrBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInBox() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java9/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("concatDynamic.kt")
public void testConcatDynamic() throws Exception {
runTest("compiler/testData/codegen/java9/box/concatDynamic.kt");
}
@TestMetadata("concatDynamic200.kt")
public void testConcatDynamic200() throws Exception {
runTest("compiler/testData/codegen/java9/box/concatDynamic200.kt");
}
@TestMetadata("concatDynamic201.kt")
public void testConcatDynamic201() throws Exception {
runTest("compiler/testData/codegen/java9/box/concatDynamic201.kt");
}
@TestMetadata("concatDynamicIndy200.kt")
public void testConcatDynamicIndy200() throws Exception {
runTest("compiler/testData/codegen/java9/box/concatDynamicIndy200.kt");
}
@TestMetadata("concatDynamicIndy201.kt")
public void testConcatDynamicIndy201() throws Exception {
runTest("compiler/testData/codegen/java9/box/concatDynamicIndy201.kt");
}
@TestMetadata("concatDynamicInlineClasses.kt")
public void testConcatDynamicInlineClasses() throws Exception {
runTest("compiler/testData/codegen/java9/box/concatDynamicInlineClasses.kt");
}
@TestMetadata("concatDynamicWithInline.kt")
public void testConcatDynamicWithInline() throws Exception {
runTest("compiler/testData/codegen/java9/box/concatDynamicWithInline.kt");
}
@TestMetadata("kt36984.kt")
public void testKt36984() throws Exception {
runTest("compiler/testData/codegen/java9/box/kt36984.kt");
}
@TestMetadata("varHandle.kt")
public void testVarHandle() throws Exception {
runTest("compiler/testData/codegen/java9/box/varHandle.kt");
}
}