From 25d2e61a824d135c7f1f0de0be75cb4b08e1852e Mon Sep 17 00:00:00 2001 From: Nikolay Lunyak Date: Thu, 15 Jul 2021 15:37:16 +0300 Subject: [PATCH] [FIR2IR] Adding 2 new runners for fir2ir-specific tests --- .../fir/fir2ir/testData/codegen/box/sample.kt | 1 + .../fir/fir2ir/testData/ir/irText/sample.kt | 2 ++ .../fir2ir/testData/ir/irText/sample.kt.txt | 2 ++ .../fir/fir2ir/testData/ir/irText/sample.txt | 3 ++ ...rSpecificBlackBoxCodegenTestGenerated.java | 33 +++++++++++++++++++ .../ir/Fir2IrSpecificTextTestGenerated.java | 33 +++++++++++++++++++ .../generators/GenerateJUnit5CompilerTests.kt | 14 ++++++++ 7 files changed, 88 insertions(+) create mode 100644 compiler/fir/fir2ir/testData/codegen/box/sample.kt create mode 100644 compiler/fir/fir2ir/testData/ir/irText/sample.kt create mode 100644 compiler/fir/fir2ir/testData/ir/irText/sample.kt.txt create mode 100644 compiler/fir/fir2ir/testData/ir/irText/sample.txt create mode 100644 compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSpecificBlackBoxCodegenTestGenerated.java create mode 100644 compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrSpecificTextTestGenerated.java diff --git a/compiler/fir/fir2ir/testData/codegen/box/sample.kt b/compiler/fir/fir2ir/testData/codegen/box/sample.kt new file mode 100644 index 00000000000..9e371edbc41 --- /dev/null +++ b/compiler/fir/fir2ir/testData/codegen/box/sample.kt @@ -0,0 +1 @@ +fun box() = "OK" diff --git a/compiler/fir/fir2ir/testData/ir/irText/sample.kt b/compiler/fir/fir2ir/testData/ir/irText/sample.kt new file mode 100644 index 00000000000..7528383fc82 --- /dev/null +++ b/compiler/fir/fir2ir/testData/ir/irText/sample.kt @@ -0,0 +1,2 @@ +// FIR_IDENTICAL +fun sample() {} diff --git a/compiler/fir/fir2ir/testData/ir/irText/sample.kt.txt b/compiler/fir/fir2ir/testData/ir/irText/sample.kt.txt new file mode 100644 index 00000000000..944e04220b4 --- /dev/null +++ b/compiler/fir/fir2ir/testData/ir/irText/sample.kt.txt @@ -0,0 +1,2 @@ +fun sample() { +} diff --git a/compiler/fir/fir2ir/testData/ir/irText/sample.txt b/compiler/fir/fir2ir/testData/ir/irText/sample.txt new file mode 100644 index 00000000000..3dfd109d8ab --- /dev/null +++ b/compiler/fir/fir2ir/testData/ir/irText/sample.txt @@ -0,0 +1,3 @@ +FILE fqName: fileName:/sample.kt + FUN name:sample visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSpecificBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSpecificBlackBoxCodegenTestGenerated.java new file mode 100644 index 00000000000..a69096ed878 --- /dev/null +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirSpecificBlackBoxCodegenTestGenerated.java @@ -0,0 +1,33 @@ +/* + * 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 java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/fir/fir2ir/testData/codegen/box") +@TestDataPath("$PROJECT_ROOT") +public class FirSpecificBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenTest { + @Test + public void testAllFilesPresentInBox() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("sample.kt") + public void testSample() throws Exception { + runTest("compiler/fir/fir2ir/testData/codegen/box/sample.kt"); + } +} diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrSpecificTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrSpecificTextTestGenerated.java new file mode 100644 index 00000000000..0a1a83005a0 --- /dev/null +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrSpecificTextTestGenerated.java @@ -0,0 +1,33 @@ +/* + * 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.ir; + +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 java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/fir/fir2ir/testData/ir/irText") +@TestDataPath("$PROJECT_ROOT") +public class Fir2IrSpecificTextTestGenerated extends AbstractFir2IrTextTest { + @Test + public void testAllFilesPresentInIrText() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/fir2ir/testData/ir/irText"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("sample.kt") + public void testSample() throws Exception { + runTest("compiler/fir/fir2ir/testData/ir/irText/sample.kt"); + } +} diff --git a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt index 9927f39608f..2a7d32dd9fb 100644 --- a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt +++ b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt @@ -161,6 +161,20 @@ fun generateJUnit5CompilerTests(args: Array) { } } + testGroup(testsRoot = "compiler/fir/fir2ir/tests-gen", testDataRoot = "compiler/fir/fir2ir/testData") { + testClass( + suiteTestClassName = "FirSpecificBlackBoxCodegenTestGenerated" + ) { + model("codegen/box") + } + + testClass( + suiteTestClassName = "Fir2IrSpecificTextTestGenerated" + ) { + model("ir/irText") + } + } + testGroup("compiler/fir/analysis-tests/tests-gen", "compiler/fir/analysis-tests/testData") { testClass { model("resolve", pattern = TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME)