[Test] Generated FIR codegen tests on modern jdk

This commit is contained in:
Dmitriy Novozhilov
2021-10-08 16:39:07 +03:00
committed by TeamCityServer
parent 63d841247c
commit 8fd2474b9e
11 changed files with 311 additions and 1 deletions
@@ -0,0 +1,298 @@
/*
* Copyright 2010-2021 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.test.runners.codegen;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Tag;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/boxModernJdk")
@TestDataPath("$PROJECT_ROOT")
public class FirBlackBoxModernJdkCodegenTestGenerated extends AbstractFirBlackBoxCodegenTest {
@Test
public void testAllFilesPresentInBoxModernJdk() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Nested
@Tag("<modernJava>")
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava11")
@TestDataPath("$PROJECT_ROOT")
public class TestsWithJava11 {
@Test
public void testAllFilesPresentInTestsWithJava11() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava11"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("concatDynamic.kt")
public void testConcatDynamic() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamic.kt");
}
@Test
@TestMetadata("concatDynamic199Long.kt")
public void testConcatDynamic199Long() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamic199Long.kt");
}
@Test
@TestMetadata("concatDynamic200.kt")
public void testConcatDynamic200() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamic200.kt");
}
@Test
@TestMetadata("concatDynamic200Long.kt")
public void testConcatDynamic200Long() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamic200Long.kt");
}
@Test
@TestMetadata("concatDynamic201.kt")
public void testConcatDynamic201() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamic201.kt");
}
@Test
@TestMetadata("concatDynamicIndy199Long.kt")
public void testConcatDynamicIndy199Long() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicIndy199Long.kt");
}
@Test
@TestMetadata("concatDynamicIndy200.kt")
public void testConcatDynamicIndy200() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicIndy200.kt");
}
@Test
@TestMetadata("concatDynamicIndy200Long.kt")
public void testConcatDynamicIndy200Long() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicIndy200Long.kt");
}
@Test
@TestMetadata("concatDynamicIndy201.kt")
public void testConcatDynamicIndy201() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicIndy201.kt");
}
@Test
@TestMetadata("concatDynamicInlineClasses.kt")
public void testConcatDynamicInlineClasses() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicInlineClasses.kt");
}
@Test
@TestMetadata("concatDynamicSpecialSymbols.kt")
public void testConcatDynamicSpecialSymbols() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicSpecialSymbols.kt");
}
@Test
@TestMetadata("concatDynamicWithInline.kt")
public void testConcatDynamicWithInline() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/concatDynamicWithInline.kt");
}
@Test
@TestMetadata("kt36984.kt")
public void testKt36984() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/kt36984.kt");
}
@Test
@TestMetadata("kt47917.kt")
public void testKt47917() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/kt47917.kt");
}
@Test
@TestMetadata("kt47917_oldBackend.kt")
public void testKt47917_oldBackend() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/kt47917_oldBackend.kt");
}
@Test
@TestMetadata("kt47917_russian.kt")
public void testKt47917_russian() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/kt47917_russian.kt");
}
@Test
@TestMetadata("kt47917_surrogatePairs.kt")
public void testKt47917_surrogatePairs() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/kt47917_surrogatePairs.kt");
}
@Test
@TestMetadata("varHandle.kt")
public void testVarHandle() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava11/varHandle.kt");
}
}
@Nested
@Tag("<modernJava>")
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava17")
@TestDataPath("$PROJECT_ROOT")
public class TestsWithJava17 {
@Test
public void testAllFilesPresentInTestsWithJava17() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava17"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Nested
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava17/records")
@TestDataPath("$PROJECT_ROOT")
public class Records {
@Test
public void testAllFilesPresentInRecords() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava17/records"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("bytecodeShapeForJava.kt")
public void testBytecodeShapeForJava() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/bytecodeShapeForJava.kt");
}
@Test
@TestMetadata("collectionSizeOverrides.kt")
public void testCollectionSizeOverrides() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/collectionSizeOverrides.kt");
}
@Test
@TestMetadata("dataJvmRecord.kt")
public void testDataJvmRecord() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/dataJvmRecord.kt");
}
@Test
@TestMetadata("jvmRecordBinary.kt")
public void testJvmRecordBinary() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/jvmRecordBinary.kt");
}
@Test
@TestMetadata("propertiesOverrides.kt")
public void testPropertiesOverrides() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/propertiesOverrides.kt");
}
@Test
@TestMetadata("propertiesOverridesAllCompatibilityJvmDefault.kt")
public void testPropertiesOverridesAllCompatibilityJvmDefault() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/propertiesOverridesAllCompatibilityJvmDefault.kt");
}
@Test
@TestMetadata("propertiesOverridesEnableJvmDefault.kt")
public void testPropertiesOverridesEnableJvmDefault() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/propertiesOverridesEnableJvmDefault.kt");
}
@Test
@TestMetadata("recordDifferentPropertyOverride.kt")
public void testRecordDifferentPropertyOverride() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordDifferentPropertyOverride.kt");
}
@Test
@TestMetadata("recordDifferentSyntheticProperty.kt")
public void testRecordDifferentSyntheticProperty() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordDifferentSyntheticProperty.kt");
}
@Test
@TestMetadata("recordPropertyAccess.kt")
public void testRecordPropertyAccess() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/records/recordPropertyAccess.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed")
@TestDataPath("$PROJECT_ROOT")
public class Sealed {
@Test
public void testAllFilesPresentInSealed() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("compiledJavaSealedClass.kt")
public void testCompiledJavaSealedClass() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed/compiledJavaSealedClass.kt");
}
@Test
@TestMetadata("compiledJavaSealedInterface.kt")
public void testCompiledJavaSealedInterface() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed/compiledJavaSealedInterface.kt");
}
@Test
@TestMetadata("javaExhaustiveWhenOnKotlinSealedClass.kt")
public void testJavaExhaustiveWhenOnKotlinSealedClass() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed/javaExhaustiveWhenOnKotlinSealedClass.kt");
}
@Test
@TestMetadata("javaRecordsViaKotlinReflection.kt")
public void testJavaRecordsViaKotlinReflection() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed/javaRecordsViaKotlinReflection.kt");
}
@Test
@TestMetadata("javaSealedClass.kt")
public void testJavaSealedClass() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed/javaSealedClass.kt");
}
@Test
@TestMetadata("javaSealedInterface.kt")
public void testJavaSealedInterface() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed/javaSealedInterface.kt");
}
@Test
@TestMetadata("permittedSubclassesOfSealedKotlinClass.kt")
public void testPermittedSubclassesOfSealedKotlinClass() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed/permittedSubclassesOfSealedKotlinClass.kt");
}
@Test
@TestMetadata("sealedJavaClassViaJavaReflection.kt")
public void testSealedJavaClassViaJavaReflection() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed/sealedJavaClassViaJavaReflection.kt");
}
@Test
@TestMetadata("sealedJavaClassViaKotlinReflection.kt")
public void testSealedJavaClassViaKotlinReflection() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed/sealedJavaClassViaKotlinReflection.kt");
}
@Test
@TestMetadata("sealedJavaInterfaceViaKotlinReflection.kt")
public void testSealedJavaInterfaceViaKotlinReflection() throws Exception {
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava17/sealed/sealedJavaInterfaceViaKotlinReflection.kt");
}
}
}
}
@@ -1,6 +1,7 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
// ^ JVM_IR back-end generates SAM conversion with invokedynamic
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
fun box(): String {
@@ -1,5 +1,6 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// IGNORE_BACKEND_FIR: JVM_IR
// ENABLE_JVM_PREVIEW
// FILE: JavaClass.java
public class JavaClass {
@@ -1,5 +1,6 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// IGNORE_BACKEND_FIR: JVM_IR
// ENABLE_JVM_PREVIEW
// FILE: JavaClass.java
@@ -1,6 +1,7 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// ENABLE_JVM_PREVIEW
// IGNORE_BACKEND_FIR: JVM_IR
// !JVM_DEFAULT_MODE: all-compatibility
// FILE: JavaClass.java
@@ -1,6 +1,7 @@
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// ENABLE_JVM_PREVIEW
// IGNORE_BACKEND_FIR: JVM_IR
// !JVM_DEFAULT_MODE: enable
// FILE: JavaClass.java
@@ -1,4 +1,5 @@
// ENABLE_JVM_PREVIEW
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: MyRec.java
public record MyRec(String name) implements KI {
public String getName() {
@@ -1,4 +1,5 @@
// ENABLE_JVM_PREVIEW
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: MyRec.java
public record MyRec(String name) {
public String getName() {
@@ -1,4 +1,5 @@
// !LANGUAGE: +JvmRecordSupport
// IGNORE_BACKEND_FIR: JVM_IR
// ENABLE_JVM_PREVIEW
// FILE: MyRec.java
public record MyRec(String name) {}
@@ -1,5 +1,5 @@
// WITH_REFLECT
// ATTACH_DEBUGGERp
// IGNORE_BACKEND_FIR: JVM_IR
// ISSUE: KT-47760
// FILE: MyRecord.java
@@ -193,6 +193,10 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
model("codegen/box")
}
testClass<AbstractFirBlackBoxCodegenTest>("FirBlackBoxModernJdkCodegenTestGenerated") {
model("codegen/boxModernJdk")
}
testClass<AbstractFirBlackBoxInlineCodegenTest> {
model("codegen/boxInline")
}