Rewrite compiler visualizer tests using new test infrastructure

This commit is contained in:
Ivan Kylchik
2021-02-04 20:23:04 +03:00
committed by TeamCityServer
parent 4c0cab4756
commit 4ac38e5f29
10 changed files with 326 additions and 213 deletions
@@ -516,25 +516,5 @@ fun generateJUnit3CompilerTests(args: Array<String>) {
model("lightClasses") model("lightClasses")
} }
} }
testGroup("compiler/visualizer/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") {
testClass<AbstractPsiVisualizer>("PsiVisualizerForRawFirDataGenerated") {
model("rawBuilder", testMethod = "doFirBuilderDataTest")
}
testClass<AbstractFirVisualizer>("FirVisualizerForRawFirDataGenerated") {
model("rawBuilder", testMethod = "doFirBuilderDataTest")
}
}
testGroup("compiler/visualizer/tests-gen", "compiler/visualizer/testData") {
testClass<AbstractPsiVisualizer>("PsiVisualizerForUncommonCasesGenerated") {
model("uncommonCases/testFiles", testMethod = "doUncommonCasesTest")
}
testClass<AbstractFirVisualizer>("FirVisualizerForUncommonCasesGenerated") {
model("uncommonCases/testFiles", testMethod = "doUncommonCasesTest")
}
}
} }
} }
@@ -12,6 +12,8 @@ import org.jetbrains.kotlin.test.runners.*
import org.jetbrains.kotlin.test.runners.codegen.* import org.jetbrains.kotlin.test.runners.codegen.*
import org.jetbrains.kotlin.test.runners.ir.AbstractFir2IrTextTest import org.jetbrains.kotlin.test.runners.ir.AbstractFir2IrTextTest
import org.jetbrains.kotlin.test.runners.ir.AbstractIrTextTest import org.jetbrains.kotlin.test.runners.ir.AbstractIrTextTest
import org.jetbrains.kotlin.visualizer.fir.AbstractFirVisualizer
import org.jetbrains.kotlin.visualizer.psi.AbstractPsiVisualizer
import org.junit.jupiter.api.parallel.Execution import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode import org.junit.jupiter.api.parallel.ExecutionMode
@@ -155,5 +157,25 @@ fun generateJUnit5CompilerTests(args: Array<String>) {
model("codegen/bytecodeText") model("codegen/bytecodeText")
} }
} }
testGroup("compiler/visualizer/tests-gen", "compiler/fir/raw-fir/psi2fir/testData") {
testClass<AbstractPsiVisualizer>("PsiVisualizerForRawFirDataGenerated") {
model("rawBuilder")
}
testClass<AbstractFirVisualizer>("FirVisualizerForRawFirDataGenerated") {
model("rawBuilder")
}
}
testGroup("compiler/visualizer/tests-gen", "compiler/visualizer/testData") {
testClass<AbstractPsiVisualizer>("PsiVisualizerForUncommonCasesGenerated") {
model("uncommonCases/testFiles")
}
testClass<AbstractFirVisualizer>("FirVisualizerForUncommonCasesGenerated") {
model("uncommonCases/testFiles")
}
}
} }
} }
+14 -6
View File
@@ -11,12 +11,18 @@ dependencies {
testCompileOnly(project(":compiler:fir:raw-fir:psi2fir")) testCompileOnly(project(":compiler:fir:raw-fir:psi2fir"))
testCompileOnly(project(":compiler:visualizer:render-psi")) testImplementation(project(":compiler:visualizer:render-psi"))
testCompileOnly(project(":compiler:visualizer:render-fir")) testImplementation(project(":compiler:visualizer:render-fir"))
testCompile(commonDep("junit:junit")) testApi(platform("org.junit:junit-bom:5.7.0"))
testCompile(projectTests(":compiler:tests-common")) testApi("org.junit.jupiter:junit-jupiter")
testCompile(projectTests(":compiler:fir:analysis-tests:legacy-fir-tests")) testApi("org.junit.platform:junit-platform-commons:1.7.0")
testApi("org.junit.platform:junit-platform-launcher:1.7.0")
testImplementation(projectTests(":compiler:tests-common"))
testImplementation(projectTests(":compiler:tests-common-new"))
testImplementation(projectTests(":compiler:test-infrastructure"))
testImplementation(projectTests(":compiler:fir:analysis-tests:legacy-fir-tests"))
} }
val generationRoot = projectDir.resolve("tests-gen") val generationRoot = projectDir.resolve("tests-gen")
@@ -36,8 +42,10 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
} }
} }
projectTest { projectTest(parallel = true, jUnit5Enabled = true) {
workingDir = rootDir workingDir = rootDir
useJUnitPlatform()
} }
testsJar() testsJar()
@@ -6,223 +6,236 @@
package org.jetbrains.kotlin.visualizer.fir; package org.jetbrains.kotlin.visualizer.fir;
import com.intellij.testFramework.TestDataPath; 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.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata; import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ /** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all") @SuppressWarnings("all")
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizer { public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizer {
private void runTest(String testDataFilePath) throws Exception { @Test
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInRawBuilder() throws Exception { public void testAllFilesPresentInRawBuilder() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) public class Declarations extends AbstractFirVisualizer {
public static class Declarations extends AbstractFirVisualizer { @Test
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInDeclarations() throws Exception { public void testAllFilesPresentInDeclarations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Test
@TestMetadata("annotation.kt") @TestMetadata("annotation.kt")
public void testAnnotation() throws Exception { public void testAnnotation() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt");
} }
@Test
@TestMetadata("complexTypes.kt") @TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception { public void testComplexTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt");
} }
@Test
@TestMetadata("constructorInObject.kt") @TestMetadata("constructorInObject.kt")
public void testConstructorInObject() throws Exception { public void testConstructorInObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorInObject.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorInObject.kt");
} }
@Test
@TestMetadata("constructorOfAnonymousObject.kt") @TestMetadata("constructorOfAnonymousObject.kt")
public void testConstructorOfAnonymousObject() throws Exception { public void testConstructorOfAnonymousObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt");
} }
@Test
@TestMetadata("delegates.kt") @TestMetadata("delegates.kt")
public void testDelegates() throws Exception { public void testDelegates() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt");
} }
@Test
@TestMetadata("derivedClass.kt") @TestMetadata("derivedClass.kt")
public void testDerivedClass() throws Exception { public void testDerivedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt");
} }
@Test
@TestMetadata("emptyAnonymousObject.kt") @TestMetadata("emptyAnonymousObject.kt")
public void testEmptyAnonymousObject() throws Exception { public void testEmptyAnonymousObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/emptyAnonymousObject.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/emptyAnonymousObject.kt");
} }
@Test
@TestMetadata("enums.kt") @TestMetadata("enums.kt")
public void testEnums() throws Exception { public void testEnums() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums.kt");
} }
@Test
@TestMetadata("enums2.kt") @TestMetadata("enums2.kt")
public void testEnums2() throws Exception { public void testEnums2() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums2.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums2.kt");
} }
@Test
@TestMetadata("expectActual.kt") @TestMetadata("expectActual.kt")
public void testExpectActual() throws Exception { public void testExpectActual() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt");
} }
@Test
@TestMetadata("external.kt") @TestMetadata("external.kt")
public void testExternal() throws Exception { public void testExternal() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt");
} }
@Test
@TestMetadata("F.kt") @TestMetadata("F.kt")
public void testF() throws Exception { public void testF() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt");
} }
@Test
@TestMetadata("functionTypes.kt") @TestMetadata("functionTypes.kt")
public void testFunctionTypes() throws Exception { public void testFunctionTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt");
} }
@Test
@TestMetadata("genericFunctions.kt") @TestMetadata("genericFunctions.kt")
public void testGenericFunctions() throws Exception { public void testGenericFunctions() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericFunctions.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericFunctions.kt");
} }
@Test
@TestMetadata("genericProperty.kt") @TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception { public void testGenericProperty() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt");
} }
@Test
@TestMetadata("nestedClass.kt") @TestMetadata("nestedClass.kt")
public void testNestedClass() throws Exception { public void testNestedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/nestedClass.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/nestedClass.kt");
} }
@Test
@TestMetadata("NestedOfAliasedType.kt") @TestMetadata("NestedOfAliasedType.kt")
public void testNestedOfAliasedType() throws Exception { public void testNestedOfAliasedType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedOfAliasedType.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedOfAliasedType.kt");
} }
@Test
@TestMetadata("NestedSuperType.kt") @TestMetadata("NestedSuperType.kt")
public void testNestedSuperType() throws Exception { public void testNestedSuperType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedSuperType.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedSuperType.kt");
} }
@Test
@TestMetadata("noPrimaryConstructor.kt") @TestMetadata("noPrimaryConstructor.kt")
public void testNoPrimaryConstructor() throws Exception { public void testNoPrimaryConstructor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noPrimaryConstructor.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noPrimaryConstructor.kt");
} }
@Test
@TestMetadata("simpleClass.kt") @TestMetadata("simpleClass.kt")
public void testSimpleClass() throws Exception { public void testSimpleClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleClass.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleClass.kt");
} }
@Test
@TestMetadata("simpleFun.kt") @TestMetadata("simpleFun.kt")
public void testSimpleFun() throws Exception { public void testSimpleFun() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleFun.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleFun.kt");
} }
@Test
@TestMetadata("simpleTypeAlias.kt") @TestMetadata("simpleTypeAlias.kt")
public void testSimpleTypeAlias() throws Exception { public void testSimpleTypeAlias() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleTypeAlias.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleTypeAlias.kt");
} }
@Test
@TestMetadata("typeAliasWithGeneric.kt") @TestMetadata("typeAliasWithGeneric.kt")
public void testTypeAliasWithGeneric() throws Exception { public void testTypeAliasWithGeneric() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeAliasWithGeneric.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeAliasWithGeneric.kt");
} }
@Test
@TestMetadata("typeParameterVsNested.kt") @TestMetadata("typeParameterVsNested.kt")
public void testTypeParameterVsNested() throws Exception { public void testTypeParameterVsNested() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.kt");
} }
@Test
@TestMetadata("typeParameters.kt") @TestMetadata("typeParameters.kt")
public void testTypeParameters() throws Exception { public void testTypeParameters() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameters.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameters.kt");
} }
@Test
@TestMetadata("where.kt") @TestMetadata("where.kt")
public void testWhere() throws Exception { public void testWhere() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/where.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/where.kt");
} }
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) public class Contracts extends AbstractFirVisualizer {
public static class Contracts extends AbstractFirVisualizer { @Test
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInContracts() throws Exception { public void testAllFilesPresentInContracts() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) public class NewSyntax extends AbstractFirVisualizer {
public static class NewSyntax extends AbstractFirVisualizer { @Test
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInNewSyntax() throws Exception { public void testAllFilesPresentInNewSyntax() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Test
@TestMetadata("functionWithBothOldAndNewSyntaxContractDescription.kt") @TestMetadata("functionWithBothOldAndNewSyntaxContractDescription.kt")
public void testFunctionWithBothOldAndNewSyntaxContractDescription() throws Exception { public void testFunctionWithBothOldAndNewSyntaxContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt");
} }
@Test
@TestMetadata("propertyAccessorsContractDescription.kt") @TestMetadata("propertyAccessorsContractDescription.kt")
public void testPropertyAccessorsContractDescription() throws Exception { public void testPropertyAccessorsContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt");
} }
@Test
@TestMetadata("simpleFunctionsContractDescription.kt") @TestMetadata("simpleFunctionsContractDescription.kt")
public void testSimpleFunctionsContractDescription() throws Exception { public void testSimpleFunctionsContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt");
} }
} }
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) public class OldSyntax extends AbstractFirVisualizer {
public static class OldSyntax extends AbstractFirVisualizer { @Test
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInOldSyntax() throws Exception { public void testAllFilesPresentInOldSyntax() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Test
@TestMetadata("contractDescription.kt") @TestMetadata("contractDescription.kt")
public void testContractDescription() throws Exception { public void testContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt");
@@ -231,163 +244,190 @@ public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizer {
} }
} }
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) public class Expressions extends AbstractFirVisualizer {
public static class Expressions extends AbstractFirVisualizer { @Test
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInExpressions() throws Exception { public void testAllFilesPresentInExpressions() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Test
@TestMetadata("annotated.kt") @TestMetadata("annotated.kt")
public void testAnnotated() throws Exception { public void testAnnotated() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt");
} }
@Test
@TestMetadata("arrayAccess.kt") @TestMetadata("arrayAccess.kt")
public void testArrayAccess() throws Exception { public void testArrayAccess() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAccess.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAccess.kt");
} }
@Test
@TestMetadata("arrayAssignment.kt") @TestMetadata("arrayAssignment.kt")
public void testArrayAssignment() throws Exception { public void testArrayAssignment() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAssignment.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAssignment.kt");
} }
@Test
@TestMetadata("branches.kt") @TestMetadata("branches.kt")
public void testBranches() throws Exception { public void testBranches() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/branches.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/branches.kt");
} }
@Test
@TestMetadata("callableReferences.kt") @TestMetadata("callableReferences.kt")
public void testCallableReferences() throws Exception { public void testCallableReferences() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/callableReferences.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/callableReferences.kt");
} }
@Test
@TestMetadata("calls.kt") @TestMetadata("calls.kt")
public void testCalls() throws Exception { public void testCalls() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt");
} }
@Test
@TestMetadata("classReference.kt") @TestMetadata("classReference.kt")
public void testClassReference() throws Exception { public void testClassReference() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/classReference.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/classReference.kt");
} }
@Test
@TestMetadata("collectionLiterals.kt") @TestMetadata("collectionLiterals.kt")
public void testCollectionLiterals() throws Exception { public void testCollectionLiterals() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.kt");
} }
@Test
@TestMetadata("destructuring.kt") @TestMetadata("destructuring.kt")
public void testDestructuring() throws Exception { public void testDestructuring() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.kt");
} }
@Test
@TestMetadata("for.kt") @TestMetadata("for.kt")
public void testFor() throws Exception { public void testFor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.kt");
} }
@Test
@TestMetadata("genericCalls.kt") @TestMetadata("genericCalls.kt")
public void testGenericCalls() throws Exception { public void testGenericCalls() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/genericCalls.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/genericCalls.kt");
} }
@Test
@TestMetadata("in.kt") @TestMetadata("in.kt")
public void testIn() throws Exception { public void testIn() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/in.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/in.kt");
} }
@Test
@TestMetadata("inBrackets.kt") @TestMetadata("inBrackets.kt")
public void testInBrackets() throws Exception { public void testInBrackets() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/inBrackets.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/inBrackets.kt");
} }
@Test
@TestMetadata("init.kt") @TestMetadata("init.kt")
public void testInit() throws Exception { public void testInit() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/init.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/init.kt");
} }
@Test
@TestMetadata("labelForInfix.kt") @TestMetadata("labelForInfix.kt")
public void testLabelForInfix() throws Exception { public void testLabelForInfix() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/labelForInfix.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/labelForInfix.kt");
} }
@Test
@TestMetadata("lambda.kt") @TestMetadata("lambda.kt")
public void testLambda() throws Exception { public void testLambda() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.kt");
} }
@Test
@TestMetadata("lambdaAndAnonymousFunction.kt") @TestMetadata("lambdaAndAnonymousFunction.kt")
public void testLambdaAndAnonymousFunction() throws Exception { public void testLambdaAndAnonymousFunction() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt");
} }
@Test
@TestMetadata("locals.kt") @TestMetadata("locals.kt")
public void testLocals() throws Exception { public void testLocals() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt");
} }
@Test
@TestMetadata("modifications.kt") @TestMetadata("modifications.kt")
public void testModifications() throws Exception { public void testModifications() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/modifications.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/modifications.kt");
} }
@Test
@TestMetadata("namedArgument.kt") @TestMetadata("namedArgument.kt")
public void testNamedArgument() throws Exception { public void testNamedArgument() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/namedArgument.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/namedArgument.kt");
} }
@Test
@TestMetadata("nullability.kt") @TestMetadata("nullability.kt")
public void testNullability() throws Exception { public void testNullability() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/nullability.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/nullability.kt");
} }
@Test
@TestMetadata("qualifierWithTypeArguments.kt") @TestMetadata("qualifierWithTypeArguments.kt")
public void testQualifierWithTypeArguments() throws Exception { public void testQualifierWithTypeArguments() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt");
} }
@Test
@TestMetadata("simpleReturns.kt") @TestMetadata("simpleReturns.kt")
public void testSimpleReturns() throws Exception { public void testSimpleReturns() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/simpleReturns.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/simpleReturns.kt");
} }
@Test
@TestMetadata("super.kt") @TestMetadata("super.kt")
public void testSuper() throws Exception { public void testSuper() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/super.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/super.kt");
} }
@Test
@TestMetadata("these.kt") @TestMetadata("these.kt")
public void testThese() throws Exception { public void testThese() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/these.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/these.kt");
} }
@Test
@TestMetadata("try.kt") @TestMetadata("try.kt")
public void testTry() throws Exception { public void testTry() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/try.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/try.kt");
} }
@Test
@TestMetadata("typeOperators.kt") @TestMetadata("typeOperators.kt")
public void testTypeOperators() throws Exception { public void testTypeOperators() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/typeOperators.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/typeOperators.kt");
} }
@Test
@TestMetadata("unary.kt") @TestMetadata("unary.kt")
public void testUnary() throws Exception { public void testUnary() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.kt");
} }
@Test
@TestMetadata("variables.kt") @TestMetadata("variables.kt")
public void testVariables() throws Exception { public void testVariables() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/variables.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/variables.kt");
} }
@Test
@TestMetadata("while.kt") @TestMetadata("while.kt")
public void testWhile() throws Exception { public void testWhile() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/while.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/while.kt");
@@ -6,69 +6,73 @@
package org.jetbrains.kotlin.visualizer.fir; package org.jetbrains.kotlin.visualizer.fir;
import com.intellij.testFramework.TestDataPath; 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.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata; import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ /** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all") @SuppressWarnings("all")
@TestMetadata("compiler/visualizer/testData/uncommonCases/testFiles") @TestMetadata("compiler/visualizer/testData/uncommonCases/testFiles")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class FirVisualizerForUncommonCasesGenerated extends AbstractFirVisualizer { public class FirVisualizerForUncommonCasesGenerated extends AbstractFirVisualizer {
private void runTest(String testDataFilePath) throws Exception { @Test
KotlinTestUtils.runTest(this::doUncommonCasesTest, this, testDataFilePath);
}
public void testAllFilesPresentInTestFiles() throws Exception { public void testAllFilesPresentInTestFiles() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/visualizer/testData/uncommonCases/testFiles"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/visualizer/testData/uncommonCases/testFiles"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Test
@TestMetadata("dataClass.kt") @TestMetadata("dataClass.kt")
public void testDataClass() throws Exception { public void testDataClass() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/dataClass.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/dataClass.kt");
} }
@Test
@TestMetadata("delegation.kt") @TestMetadata("delegation.kt")
public void testDelegation() throws Exception { public void testDelegation() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/delegation.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/delegation.kt");
} }
@Test
@TestMetadata("innerWith.kt") @TestMetadata("innerWith.kt")
public void testInnerWith() throws Exception { public void testInnerWith() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/innerWith.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/innerWith.kt");
} }
@Test
@TestMetadata("lists.kt") @TestMetadata("lists.kt")
public void testLists() throws Exception { public void testLists() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/lists.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/lists.kt");
} }
@Test
@TestMetadata("properties.kt") @TestMetadata("properties.kt")
public void testProperties() throws Exception { public void testProperties() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/properties.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/properties.kt");
} }
@Test
@TestMetadata("receiver.kt") @TestMetadata("receiver.kt")
public void testReceiver() throws Exception { public void testReceiver() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/receiver.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/receiver.kt");
} }
@Test
@TestMetadata("superTypes.kt") @TestMetadata("superTypes.kt")
public void testSuperTypes() throws Exception { public void testSuperTypes() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/superTypes.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/superTypes.kt");
} }
@Test
@TestMetadata("variance.kt") @TestMetadata("variance.kt")
public void testVariance() throws Exception { public void testVariance() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/variance.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/variance.kt");
} }
@Test
@TestMetadata("where.kt") @TestMetadata("where.kt")
public void testWhere() throws Exception { public void testWhere() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/where.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/where.kt");
@@ -6,223 +6,236 @@
package org.jetbrains.kotlin.visualizer.psi; package org.jetbrains.kotlin.visualizer.psi;
import com.intellij.testFramework.TestDataPath; 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.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata; import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ /** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all") @SuppressWarnings("all")
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizer { public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizer {
private void runTest(String testDataFilePath) throws Exception { @Test
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInRawBuilder() throws Exception { public void testAllFilesPresentInRawBuilder() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) public class Declarations extends AbstractPsiVisualizer {
public static class Declarations extends AbstractPsiVisualizer { @Test
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInDeclarations() throws Exception { public void testAllFilesPresentInDeclarations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Test
@TestMetadata("annotation.kt") @TestMetadata("annotation.kt")
public void testAnnotation() throws Exception { public void testAnnotation() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt");
} }
@Test
@TestMetadata("complexTypes.kt") @TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception { public void testComplexTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt");
} }
@Test
@TestMetadata("constructorInObject.kt") @TestMetadata("constructorInObject.kt")
public void testConstructorInObject() throws Exception { public void testConstructorInObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorInObject.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorInObject.kt");
} }
@Test
@TestMetadata("constructorOfAnonymousObject.kt") @TestMetadata("constructorOfAnonymousObject.kt")
public void testConstructorOfAnonymousObject() throws Exception { public void testConstructorOfAnonymousObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt");
} }
@Test
@TestMetadata("delegates.kt") @TestMetadata("delegates.kt")
public void testDelegates() throws Exception { public void testDelegates() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt");
} }
@Test
@TestMetadata("derivedClass.kt") @TestMetadata("derivedClass.kt")
public void testDerivedClass() throws Exception { public void testDerivedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt");
} }
@Test
@TestMetadata("emptyAnonymousObject.kt") @TestMetadata("emptyAnonymousObject.kt")
public void testEmptyAnonymousObject() throws Exception { public void testEmptyAnonymousObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/emptyAnonymousObject.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/emptyAnonymousObject.kt");
} }
@Test
@TestMetadata("enums.kt") @TestMetadata("enums.kt")
public void testEnums() throws Exception { public void testEnums() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums.kt");
} }
@Test
@TestMetadata("enums2.kt") @TestMetadata("enums2.kt")
public void testEnums2() throws Exception { public void testEnums2() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums2.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums2.kt");
} }
@Test
@TestMetadata("expectActual.kt") @TestMetadata("expectActual.kt")
public void testExpectActual() throws Exception { public void testExpectActual() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt");
} }
@Test
@TestMetadata("external.kt") @TestMetadata("external.kt")
public void testExternal() throws Exception { public void testExternal() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt");
} }
@Test
@TestMetadata("F.kt") @TestMetadata("F.kt")
public void testF() throws Exception { public void testF() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt");
} }
@Test
@TestMetadata("functionTypes.kt") @TestMetadata("functionTypes.kt")
public void testFunctionTypes() throws Exception { public void testFunctionTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt");
} }
@Test
@TestMetadata("genericFunctions.kt") @TestMetadata("genericFunctions.kt")
public void testGenericFunctions() throws Exception { public void testGenericFunctions() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericFunctions.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericFunctions.kt");
} }
@Test
@TestMetadata("genericProperty.kt") @TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception { public void testGenericProperty() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt");
} }
@Test
@TestMetadata("nestedClass.kt") @TestMetadata("nestedClass.kt")
public void testNestedClass() throws Exception { public void testNestedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/nestedClass.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/nestedClass.kt");
} }
@Test
@TestMetadata("NestedOfAliasedType.kt") @TestMetadata("NestedOfAliasedType.kt")
public void testNestedOfAliasedType() throws Exception { public void testNestedOfAliasedType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedOfAliasedType.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedOfAliasedType.kt");
} }
@Test
@TestMetadata("NestedSuperType.kt") @TestMetadata("NestedSuperType.kt")
public void testNestedSuperType() throws Exception { public void testNestedSuperType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedSuperType.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedSuperType.kt");
} }
@Test
@TestMetadata("noPrimaryConstructor.kt") @TestMetadata("noPrimaryConstructor.kt")
public void testNoPrimaryConstructor() throws Exception { public void testNoPrimaryConstructor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noPrimaryConstructor.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noPrimaryConstructor.kt");
} }
@Test
@TestMetadata("simpleClass.kt") @TestMetadata("simpleClass.kt")
public void testSimpleClass() throws Exception { public void testSimpleClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleClass.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleClass.kt");
} }
@Test
@TestMetadata("simpleFun.kt") @TestMetadata("simpleFun.kt")
public void testSimpleFun() throws Exception { public void testSimpleFun() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleFun.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleFun.kt");
} }
@Test
@TestMetadata("simpleTypeAlias.kt") @TestMetadata("simpleTypeAlias.kt")
public void testSimpleTypeAlias() throws Exception { public void testSimpleTypeAlias() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleTypeAlias.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleTypeAlias.kt");
} }
@Test
@TestMetadata("typeAliasWithGeneric.kt") @TestMetadata("typeAliasWithGeneric.kt")
public void testTypeAliasWithGeneric() throws Exception { public void testTypeAliasWithGeneric() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeAliasWithGeneric.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeAliasWithGeneric.kt");
} }
@Test
@TestMetadata("typeParameterVsNested.kt") @TestMetadata("typeParameterVsNested.kt")
public void testTypeParameterVsNested() throws Exception { public void testTypeParameterVsNested() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.kt");
} }
@Test
@TestMetadata("typeParameters.kt") @TestMetadata("typeParameters.kt")
public void testTypeParameters() throws Exception { public void testTypeParameters() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameters.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameters.kt");
} }
@Test
@TestMetadata("where.kt") @TestMetadata("where.kt")
public void testWhere() throws Exception { public void testWhere() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/where.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/where.kt");
} }
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) public class Contracts extends AbstractPsiVisualizer {
public static class Contracts extends AbstractPsiVisualizer { @Test
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInContracts() throws Exception { public void testAllFilesPresentInContracts() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) public class NewSyntax extends AbstractPsiVisualizer {
public static class NewSyntax extends AbstractPsiVisualizer { @Test
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInNewSyntax() throws Exception { public void testAllFilesPresentInNewSyntax() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Test
@TestMetadata("functionWithBothOldAndNewSyntaxContractDescription.kt") @TestMetadata("functionWithBothOldAndNewSyntaxContractDescription.kt")
public void testFunctionWithBothOldAndNewSyntaxContractDescription() throws Exception { public void testFunctionWithBothOldAndNewSyntaxContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt");
} }
@Test
@TestMetadata("propertyAccessorsContractDescription.kt") @TestMetadata("propertyAccessorsContractDescription.kt")
public void testPropertyAccessorsContractDescription() throws Exception { public void testPropertyAccessorsContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt");
} }
@Test
@TestMetadata("simpleFunctionsContractDescription.kt") @TestMetadata("simpleFunctionsContractDescription.kt")
public void testSimpleFunctionsContractDescription() throws Exception { public void testSimpleFunctionsContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt");
} }
} }
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) public class OldSyntax extends AbstractPsiVisualizer {
public static class OldSyntax extends AbstractPsiVisualizer { @Test
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInOldSyntax() throws Exception { public void testAllFilesPresentInOldSyntax() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Test
@TestMetadata("contractDescription.kt") @TestMetadata("contractDescription.kt")
public void testContractDescription() throws Exception { public void testContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt");
@@ -231,163 +244,190 @@ public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizer {
} }
} }
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions") @TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) public class Expressions extends AbstractPsiVisualizer {
public static class Expressions extends AbstractPsiVisualizer { @Test
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doFirBuilderDataTest, this, testDataFilePath);
}
public void testAllFilesPresentInExpressions() throws Exception { public void testAllFilesPresentInExpressions() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Test
@TestMetadata("annotated.kt") @TestMetadata("annotated.kt")
public void testAnnotated() throws Exception { public void testAnnotated() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt");
} }
@Test
@TestMetadata("arrayAccess.kt") @TestMetadata("arrayAccess.kt")
public void testArrayAccess() throws Exception { public void testArrayAccess() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAccess.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAccess.kt");
} }
@Test
@TestMetadata("arrayAssignment.kt") @TestMetadata("arrayAssignment.kt")
public void testArrayAssignment() throws Exception { public void testArrayAssignment() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAssignment.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAssignment.kt");
} }
@Test
@TestMetadata("branches.kt") @TestMetadata("branches.kt")
public void testBranches() throws Exception { public void testBranches() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/branches.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/branches.kt");
} }
@Test
@TestMetadata("callableReferences.kt") @TestMetadata("callableReferences.kt")
public void testCallableReferences() throws Exception { public void testCallableReferences() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/callableReferences.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/callableReferences.kt");
} }
@Test
@TestMetadata("calls.kt") @TestMetadata("calls.kt")
public void testCalls() throws Exception { public void testCalls() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt");
} }
@Test
@TestMetadata("classReference.kt") @TestMetadata("classReference.kt")
public void testClassReference() throws Exception { public void testClassReference() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/classReference.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/classReference.kt");
} }
@Test
@TestMetadata("collectionLiterals.kt") @TestMetadata("collectionLiterals.kt")
public void testCollectionLiterals() throws Exception { public void testCollectionLiterals() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.kt");
} }
@Test
@TestMetadata("destructuring.kt") @TestMetadata("destructuring.kt")
public void testDestructuring() throws Exception { public void testDestructuring() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.kt");
} }
@Test
@TestMetadata("for.kt") @TestMetadata("for.kt")
public void testFor() throws Exception { public void testFor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.kt");
} }
@Test
@TestMetadata("genericCalls.kt") @TestMetadata("genericCalls.kt")
public void testGenericCalls() throws Exception { public void testGenericCalls() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/genericCalls.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/genericCalls.kt");
} }
@Test
@TestMetadata("in.kt") @TestMetadata("in.kt")
public void testIn() throws Exception { public void testIn() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/in.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/in.kt");
} }
@Test
@TestMetadata("inBrackets.kt") @TestMetadata("inBrackets.kt")
public void testInBrackets() throws Exception { public void testInBrackets() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/inBrackets.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/inBrackets.kt");
} }
@Test
@TestMetadata("init.kt") @TestMetadata("init.kt")
public void testInit() throws Exception { public void testInit() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/init.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/init.kt");
} }
@Test
@TestMetadata("labelForInfix.kt") @TestMetadata("labelForInfix.kt")
public void testLabelForInfix() throws Exception { public void testLabelForInfix() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/labelForInfix.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/labelForInfix.kt");
} }
@Test
@TestMetadata("lambda.kt") @TestMetadata("lambda.kt")
public void testLambda() throws Exception { public void testLambda() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.kt");
} }
@Test
@TestMetadata("lambdaAndAnonymousFunction.kt") @TestMetadata("lambdaAndAnonymousFunction.kt")
public void testLambdaAndAnonymousFunction() throws Exception { public void testLambdaAndAnonymousFunction() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt");
} }
@Test
@TestMetadata("locals.kt") @TestMetadata("locals.kt")
public void testLocals() throws Exception { public void testLocals() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt");
} }
@Test
@TestMetadata("modifications.kt") @TestMetadata("modifications.kt")
public void testModifications() throws Exception { public void testModifications() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/modifications.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/modifications.kt");
} }
@Test
@TestMetadata("namedArgument.kt") @TestMetadata("namedArgument.kt")
public void testNamedArgument() throws Exception { public void testNamedArgument() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/namedArgument.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/namedArgument.kt");
} }
@Test
@TestMetadata("nullability.kt") @TestMetadata("nullability.kt")
public void testNullability() throws Exception { public void testNullability() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/nullability.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/nullability.kt");
} }
@Test
@TestMetadata("qualifierWithTypeArguments.kt") @TestMetadata("qualifierWithTypeArguments.kt")
public void testQualifierWithTypeArguments() throws Exception { public void testQualifierWithTypeArguments() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt");
} }
@Test
@TestMetadata("simpleReturns.kt") @TestMetadata("simpleReturns.kt")
public void testSimpleReturns() throws Exception { public void testSimpleReturns() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/simpleReturns.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/simpleReturns.kt");
} }
@Test
@TestMetadata("super.kt") @TestMetadata("super.kt")
public void testSuper() throws Exception { public void testSuper() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/super.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/super.kt");
} }
@Test
@TestMetadata("these.kt") @TestMetadata("these.kt")
public void testThese() throws Exception { public void testThese() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/these.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/these.kt");
} }
@Test
@TestMetadata("try.kt") @TestMetadata("try.kt")
public void testTry() throws Exception { public void testTry() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/try.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/try.kt");
} }
@Test
@TestMetadata("typeOperators.kt") @TestMetadata("typeOperators.kt")
public void testTypeOperators() throws Exception { public void testTypeOperators() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/typeOperators.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/typeOperators.kt");
} }
@Test
@TestMetadata("unary.kt") @TestMetadata("unary.kt")
public void testUnary() throws Exception { public void testUnary() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.kt");
} }
@Test
@TestMetadata("variables.kt") @TestMetadata("variables.kt")
public void testVariables() throws Exception { public void testVariables() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/variables.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/variables.kt");
} }
@Test
@TestMetadata("while.kt") @TestMetadata("while.kt")
public void testWhile() throws Exception { public void testWhile() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/while.kt"); runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/while.kt");
@@ -6,69 +6,73 @@
package org.jetbrains.kotlin.visualizer.psi; package org.jetbrains.kotlin.visualizer.psi;
import com.intellij.testFramework.TestDataPath; 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.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata; import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ /** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all") @SuppressWarnings("all")
@TestMetadata("compiler/visualizer/testData/uncommonCases/testFiles") @TestMetadata("compiler/visualizer/testData/uncommonCases/testFiles")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class PsiVisualizerForUncommonCasesGenerated extends AbstractPsiVisualizer { public class PsiVisualizerForUncommonCasesGenerated extends AbstractPsiVisualizer {
private void runTest(String testDataFilePath) throws Exception { @Test
KotlinTestUtils.runTest(this::doUncommonCasesTest, this, testDataFilePath);
}
public void testAllFilesPresentInTestFiles() throws Exception { public void testAllFilesPresentInTestFiles() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/visualizer/testData/uncommonCases/testFiles"), Pattern.compile("^(.+)\\.kt$"), null, true); KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/visualizer/testData/uncommonCases/testFiles"), Pattern.compile("^(.+)\\.kt$"), null, true);
} }
@Test
@TestMetadata("dataClass.kt") @TestMetadata("dataClass.kt")
public void testDataClass() throws Exception { public void testDataClass() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/dataClass.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/dataClass.kt");
} }
@Test
@TestMetadata("delegation.kt") @TestMetadata("delegation.kt")
public void testDelegation() throws Exception { public void testDelegation() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/delegation.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/delegation.kt");
} }
@Test
@TestMetadata("innerWith.kt") @TestMetadata("innerWith.kt")
public void testInnerWith() throws Exception { public void testInnerWith() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/innerWith.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/innerWith.kt");
} }
@Test
@TestMetadata("lists.kt") @TestMetadata("lists.kt")
public void testLists() throws Exception { public void testLists() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/lists.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/lists.kt");
} }
@Test
@TestMetadata("properties.kt") @TestMetadata("properties.kt")
public void testProperties() throws Exception { public void testProperties() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/properties.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/properties.kt");
} }
@Test
@TestMetadata("receiver.kt") @TestMetadata("receiver.kt")
public void testReceiver() throws Exception { public void testReceiver() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/receiver.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/receiver.kt");
} }
@Test
@TestMetadata("superTypes.kt") @TestMetadata("superTypes.kt")
public void testSuperTypes() throws Exception { public void testSuperTypes() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/superTypes.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/superTypes.kt");
} }
@Test
@TestMetadata("variance.kt") @TestMetadata("variance.kt")
public void testVariance() throws Exception { public void testVariance() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/variance.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/variance.kt");
} }
@Test
@TestMetadata("where.kt") @TestMetadata("where.kt")
public void testWhere() throws Exception { public void testWhere() throws Exception {
runTest("compiler/visualizer/testData/uncommonCases/testFiles/where.kt"); runTest("compiler/visualizer/testData/uncommonCases/testFiles/where.kt");
@@ -5,44 +5,64 @@
package org.jetbrains.kotlin.visualizer package org.jetbrains.kotlin.visualizer
import org.jetbrains.kotlin.checkers.KotlinMultiFileTestWithJava import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.Directives import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.KotlinBaseTest import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
import java.io.File import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendFacade
import org.jetbrains.kotlin.test.model.FrontendKind
import org.jetbrains.kotlin.test.model.FrontendOutputHandler
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
abstract class AbstractVisualizer : KotlinMultiFileTestWithJava<KotlinBaseTest.TestModule, KotlinBaseTest.TestFile>() { abstract class AbstractVisualizer : AbstractKotlinCompilerTest() {
lateinit var replacement: Pair<String, String> abstract val handler: Constructor<FrontendOutputHandler<*>>
abstract val frontendKind: FrontendKind<*>
abstract val frontendFacade: Constructor<FrontendFacade<*>>
override fun createTestModule( override fun TestConfigurationBuilder.configuration() {
name: String, globalDefaults {
dependencies: List<String>, frontend = frontendKind
friends: List<String> targetPlatform = JvmPlatforms.defaultJvmPlatform
): TestModule? = null dependencyKind = DependencyKind.Source
}
useConfigurators(
::CommonEnvironmentConfigurator,
::JvmEnvironmentConfigurator,
)
useFrontendFacades(frontendFacade)
useFrontendHandlers(handler)
override fun createTestFile(module: TestModule?, fileName: String, text: String, directives: Directives): TestFile = defaultDirectives {
TestFile(fileName, text, directives) +JvmEnvironmentConfigurationDirectives.WITH_STDLIB
}
forTestsMatching("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/*") {
defaultDirectives {
VisualizerDirectives.EXPECTED_FILE_PATH with "compiler/visualizer/testData/rawBuilder/declarations"
}
}
override fun doMultiFileTest(wholeFile: File, files: List<TestFile>) { forTestsMatching("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/*") {
val environment = createEnvironment(wholeFile, files) defaultDirectives {
doVisualizerTest(wholeFile, environment) VisualizerDirectives.EXPECTED_FILE_PATH with "compiler/visualizer/testData/rawBuilder/expressions"
}
}
forTestsMatching("compiler/visualizer/testData/uncommonCases/*") {
defaultDirectives {
VisualizerDirectives.EXPECTED_FILE_PATH with "compiler/visualizer/testData/uncommonCases/resultFiles"
}
}
} }
}
abstract fun doVisualizerTest(file: File, environment: KotlinCoreEnvironment) internal object VisualizerDirectives : SimpleDirectivesContainer() {
val EXPECTED_FILE_PATH by stringDirective(
override fun isKotlinSourceRootNeeded(): Boolean { description = "Specify the path to expected result file"
return true )
}
fun doFirBuilderDataTest(filePath: String) {
replacement = "fir${File.separator}psi2fir" to "visualizer"
doTest(filePath)
}
fun doUncommonCasesTest(filePath: String) {
replacement = "testFiles" to "resultFiles"
doTest(filePath)
}
} }
@@ -5,66 +5,47 @@
package org.jetbrains.kotlin.visualizer.fir package org.jetbrains.kotlin.visualizer.fir
import com.intellij.psi.PsiElementFinder
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
import org.jetbrains.kotlin.compiler.visualizer.FirVisualizer import org.jetbrains.kotlin.compiler.visualizer.FirVisualizer
import org.jetbrains.kotlin.fir.builder.RawFirBuilder import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.fir.createSessionForTests
import org.jetbrains.kotlin.fir.render
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveProcessor
import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade
import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact
import org.jetbrains.kotlin.test.frontend.fir.handlers.FirAnalysisHandler
import org.jetbrains.kotlin.test.model.*
import org.jetbrains.kotlin.test.services.defaultDirectives
import org.jetbrains.kotlin.visualizer.AbstractVisualizer import org.jetbrains.kotlin.visualizer.AbstractVisualizer
import org.jetbrains.kotlin.visualizer.VisualizerDirectives
import org.junit.Assert import org.junit.Assert
import java.io.File import java.io.File
abstract class AbstractFirVisualizer : AbstractVisualizer() { abstract class AbstractFirVisualizer : AbstractVisualizer() {
override fun doVisualizerTest(file: File, environment: KotlinCoreEnvironment) { override val frontendKind: FrontendKind<*> = FrontendKinds.FIR
PsiElementFinder.EP.getPoint(environment.project) override val frontendFacade: Constructor<FrontendFacade<*>> = { FirFrontendFacade(it) }
.unregisterExtension(JavaElementFinder::class.java)
val ktFiles = environment.getSourceFiles() override val handler: Constructor<FrontendOutputHandler<*>> = {
val scope = GlobalSearchScope.filesScope(environment.project, ktFiles.mapNotNull { it.virtualFile }) object : FirAnalysisHandler(it) {
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(environment.project)) override fun processModule(module: TestModule, info: FirOutputArtifact) {
val session = createSessionForTests(environment, scope) val renderer = FirVisualizer(info.firFiles.values.first())
val firRenderResult = renderer.render()
val firProvider = (session.firProvider as FirProviderImpl) val fileName = info.firFiles.keys.first().name
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider) val expectedPath = it.defaultDirectives.get(VisualizerDirectives.EXPECTED_FILE_PATH).first() + "/$fileName"
val expectedText = File(expectedPath).readLines()
if (expectedText[0].startsWith("// FIR_IGNORE")) {
Assert.assertFalse(
"Files are identical, please delete ignore directive",
expectedText.filterIndexed { index, _ -> index > 0 }.joinToString("\n") == firRenderResult
)
return
}
KotlinTestUtils.assertEqualsToFile(File(expectedPath), firRenderResult) {
return@assertEqualsToFile it.replace("// FIR_IGNORE\n", "")
}
}
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {
val transformer = FirTotalResolveProcessor(session)
val firFiles = ktFiles.map {
val firFile = builder.buildFirFile(it)
firProvider.recordFile(firFile)
firFile
}.also {
try {
transformer.process(it)
} catch (e: Exception) {
it.forEach { println(it.render()) }
throw e
} }
} }
//compare
val renderer = FirVisualizer(firFiles.first())
val psiRenderResult = renderer.render()
val expectedPath = file.absolutePath.replace(replacement.first, replacement.second)
val expectedText = File(expectedPath).readLines()
if (expectedText[0].startsWith("// FIR_IGNORE")) {
Assert.assertFalse(
"Files are identical, please delete ignore directive",
expectedText.filterIndexed { index, _ -> index > 0 }.joinToString("\n") == psiRenderResult
)
return
}
KotlinTestUtils.assertEqualsToFile(File(expectedPath), psiRenderResult) {
return@assertEqualsToFile it.replace("// FIR_IGNORE\n", "")
}
} }
} }
@@ -5,24 +5,38 @@
package org.jetbrains.kotlin.visualizer.psi package org.jetbrains.kotlin.visualizer.psi
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.compiler.visualizer.PsiVisualizer import org.jetbrains.kotlin.compiler.visualizer.PsiVisualizer
import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact
import org.jetbrains.kotlin.test.frontend.classic.handlers.ClassicFrontendAnalysisHandler
import org.jetbrains.kotlin.test.model.*
import org.jetbrains.kotlin.test.services.defaultDirectives
import org.jetbrains.kotlin.visualizer.AbstractVisualizer import org.jetbrains.kotlin.visualizer.AbstractVisualizer
import org.jetbrains.kotlin.visualizer.VisualizerDirectives
import java.io.File import java.io.File
abstract class AbstractPsiVisualizer : AbstractVisualizer() { abstract class AbstractPsiVisualizer : AbstractVisualizer() {
override fun doVisualizerTest(file: File, environment: KotlinCoreEnvironment) { override val frontendKind: FrontendKind<*> = FrontendKinds.ClassicFrontend
val ktFiles = environment.getSourceFiles() override val frontendFacade: Constructor<FrontendFacade<*>> = { ClassicFrontendFacade(it) }
val analysisResult = JvmResolveUtil.analyze(ktFiles, environment)
val renderer = PsiVisualizer(ktFiles.first(), analysisResult) override val handler: Constructor<FrontendOutputHandler<*>> = {
val psiRenderResult = renderer.render() object : ClassicFrontendAnalysisHandler(it) {
override fun processModule(module: TestModule, info: ClassicFrontendOutputArtifact) {
val renderer = PsiVisualizer(info.ktFiles.values.first(), info.analysisResult)
val psiRenderResult = renderer.render()
val expectedPath = file.absolutePath.replace(replacement.first, replacement.second) val fileName = info.ktFiles.keys.first().name
KotlinTestUtils.assertEqualsToFile(File(expectedPath), psiRenderResult) { val expectedPath = it.defaultDirectives.get(VisualizerDirectives.EXPECTED_FILE_PATH).first() + "/$fileName"
return@assertEqualsToFile it.replace("// FIR_IGNORE\n", "") KotlinTestUtils.assertEqualsToFile(File(expectedPath), psiRenderResult) {
return@assertEqualsToFile it.replace("// FIR_IGNORE\n", "")
}
}
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {
}
} }
} }
} }