diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index f5de14f41ca..ac60790ce72 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -980,11 +980,14 @@ fun main(args: Array) { } } - testGroup("idea/idea-fir/tests", "idea/testData") { + testGroup("idea/idea-fir/tests", "idea") { testClass { - model("highlighter") + model("testData/highlighter") + model("idea-fir/testData/highlighterFir", pattern = KT_WITHOUT_DOTS_IN_NAME) } + } + testGroup("idea/idea-fir/tests", "idea/testData") { testClass { model("resolve/references", pattern = KT_WITHOUT_DOTS_IN_NAME) } diff --git a/idea/idea-fir/testData/highlighterFir/consturctor.external.kt b/idea/idea-fir/testData/highlighterFir/consturctor.external.kt new file mode 100644 index 00000000000..bd62664bc2b --- /dev/null +++ b/idea/idea-fir/testData/highlighterFir/consturctor.external.kt @@ -0,0 +1,3 @@ +interface X + +class B(private val parent: X, private val int: Int = 42) \ No newline at end of file diff --git a/idea/idea-fir/testData/highlighterFir/consturctor.kt b/idea/idea-fir/testData/highlighterFir/consturctor.kt new file mode 100644 index 00000000000..514afd04204 --- /dev/null +++ b/idea/idea-fir/testData/highlighterFir/consturctor.kt @@ -0,0 +1,3 @@ +class A : X { + private val x = B(this) +} \ No newline at end of file diff --git a/idea/idea-fir/testData/highlighterFir/extensionProperty.external.kt b/idea/idea-fir/testData/highlighterFir/extensionProperty.external.kt new file mode 100644 index 00000000000..cd78bba5305 --- /dev/null +++ b/idea/idea-fir/testData/highlighterFir/extensionProperty.external.kt @@ -0,0 +1,5 @@ +interface A { + val q: Int +} + +val A.extension: Int get() = q \ No newline at end of file diff --git a/idea/idea-fir/testData/highlighterFir/extensionProperty.kt b/idea/idea-fir/testData/highlighterFir/extensionProperty.kt new file mode 100644 index 00000000000..8a7b902e88b --- /dev/null +++ b/idea/idea-fir/testData/highlighterFir/extensionProperty.kt @@ -0,0 +1,3 @@ +class C(val a: A) { + val e = a.extension +} \ No newline at end of file diff --git a/idea/idea-fir/testData/highlighterFir/withCall.external.kt b/idea/idea-fir/testData/highlighterFir/withCall.external.kt new file mode 100644 index 00000000000..ff07958828b --- /dev/null +++ b/idea/idea-fir/testData/highlighterFir/withCall.external.kt @@ -0,0 +1,5 @@ +interface A { + fun bar(a: String = "", b: C, c: String = "") +} + +interface C \ No newline at end of file diff --git a/idea/idea-fir/testData/highlighterFir/withCall.kt b/idea/idea-fir/testData/highlighterFir/withCall.kt new file mode 100644 index 00000000000..606ccd67dbf --- /dev/null +++ b/idea/idea-fir/testData/highlighterFir/withCall.kt @@ -0,0 +1,8 @@ +class B { + fun q(): C {} + private val y = q() + + fun foo(a: A) = with(a) { + bar("a", y) + } +} \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt index abfdeb0e4b5..57918f63403 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.idea.highlighter +import org.jetbrains.kotlin.idea.addExternalTestFiles import org.jetbrains.kotlin.idea.shouldBeRethrown import org.jetbrains.kotlin.idea.test.ProjectDescriptorWithStdlibSources import org.jetbrains.kotlin.idea.withPossiblyDisabledDuplicatedFirSourceElementsException @@ -17,6 +18,11 @@ abstract class AbstractFirHighlightingTest : AbstractHighlightingTest() { override fun isFirPlugin() = true + override fun doTest(unused: String?) { + addExternalTestFiles(testPath()) + super.doTest(unused) + } + override fun checkHighlighting(fileText: String) { val doComparison = !InTextDirectivesUtils.isDirectiveDefined(myFixture.file.text, "IGNORE_FIR") val checkInfos = !InTextDirectivesUtils.isDirectiveDefined(fileText, NO_CHECK_INFOS_PREFIX); diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/FirHighlightingTestGenerated.java b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/FirHighlightingTestGenerated.java index c85b2d57258..73fe393be56 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/FirHighlightingTestGenerated.java +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/FirHighlightingTestGenerated.java @@ -16,238 +16,269 @@ import java.util.regex.Pattern; /** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") -@TestMetadata("idea/testData/highlighter") -@TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public class FirHighlightingTestGenerated extends AbstractFirHighlightingTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInHighlighter() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/highlighter"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("Annotations.kt") - public void testAnnotations() throws Exception { - runTest("idea/testData/highlighter/Annotations.kt"); - } - - @TestMetadata("AutoCreatedItParameter.kt") - public void testAutoCreatedItParameter() throws Exception { - runTest("idea/testData/highlighter/AutoCreatedItParameter.kt"); - } - - @TestMetadata("Destructuring.kt") - public void testDestructuring() throws Exception { - runTest("idea/testData/highlighter/Destructuring.kt"); - } - - @TestMetadata("Dynamic.kt") - public void testDynamic() throws Exception { - runTest("idea/testData/highlighter/Dynamic.kt"); - } - - @TestMetadata("Enums.kt") - public void testEnums() throws Exception { - runTest("idea/testData/highlighter/Enums.kt"); - } - - @TestMetadata("Field.kt") - public void testField() throws Exception { - runTest("idea/testData/highlighter/Field.kt"); - } - - @TestMetadata("Functions.kt") - public void testFunctions() throws Exception { - runTest("idea/testData/highlighter/Functions.kt"); - } - - @TestMetadata("InvokeCall.kt") - public void testInvokeCall() throws Exception { - runTest("idea/testData/highlighter/InvokeCall.kt"); - } - - @TestMetadata("JavaTypes.kt") - public void testJavaTypes() throws Exception { - runTest("idea/testData/highlighter/JavaTypes.kt"); - } - - @TestMetadata("KDoc.kt") - public void testKDoc() throws Exception { - runTest("idea/testData/highlighter/KDoc.kt"); - } - - @TestMetadata("KotlinInjection.kt") - public void testKotlinInjection() throws Exception { - runTest("idea/testData/highlighter/KotlinInjection.kt"); - } - - @TestMetadata("Labels.kt") - public void testLabels() throws Exception { - runTest("idea/testData/highlighter/Labels.kt"); - } - - @TestMetadata("NamedArguments.kt") - public void testNamedArguments() throws Exception { - runTest("idea/testData/highlighter/NamedArguments.kt"); - } - - @TestMetadata("NonNullAssertion.kt") - public void testNonNullAssertion() throws Exception { - runTest("idea/testData/highlighter/NonNullAssertion.kt"); - } - - @TestMetadata("Object.kt") - public void testObject() throws Exception { - runTest("idea/testData/highlighter/Object.kt"); - } - - @TestMetadata("PropertiesWithPropertyDeclarations.kt") - public void testPropertiesWithPropertyDeclarations() throws Exception { - runTest("idea/testData/highlighter/PropertiesWithPropertyDeclarations.kt"); - } - - @TestMetadata("SmartCast.kt") - public void testSmartCast() throws Exception { - runTest("idea/testData/highlighter/SmartCast.kt"); - } - - @TestMetadata("Suspend.kt") - public void testSuspend() throws Exception { - runTest("idea/testData/highlighter/Suspend.kt"); - } - - @TestMetadata("SyntheticExtensionProperty.kt") - public void testSyntheticExtensionProperty() throws Exception { - runTest("idea/testData/highlighter/SyntheticExtensionProperty.kt"); - } - - @TestMetadata("Todo.kt") - public void testTodo() throws Exception { - runTest("idea/testData/highlighter/Todo.kt"); - } - - @TestMetadata("TopLevelDestructuring.kt") - public void testTopLevelDestructuring() throws Exception { - runTest("idea/testData/highlighter/TopLevelDestructuring.kt"); - } - - @TestMetadata("TopLevelOpenSuspendFun.kt") - public void testTopLevelOpenSuspendFun() throws Exception { - runTest("idea/testData/highlighter/TopLevelOpenSuspendFun.kt"); - } - - @TestMetadata("TypeAlias.kt") - public void testTypeAlias() throws Exception { - runTest("idea/testData/highlighter/TypeAlias.kt"); - } - - @TestMetadata("TypesAndAnnotations.kt") - public void testTypesAndAnnotations() throws Exception { - runTest("idea/testData/highlighter/TypesAndAnnotations.kt"); - } - - @TestMetadata("Variables.kt") - public void testVariables() throws Exception { - runTest("idea/testData/highlighter/Variables.kt"); - } - - @TestMetadata("VariablesAsFunctions.kt") - public void testVariablesAsFunctions() throws Exception { - runTest("idea/testData/highlighter/VariablesAsFunctions.kt"); - } - - @TestMetadata("idea/testData/highlighter/deprecated") + @TestMetadata("idea/testData/highlighter") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class Deprecated extends AbstractFirHighlightingTest { + public static class Highlighter extends AbstractFirHighlightingTest { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - public void testAllFilesPresentInDeprecated() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/highlighter/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, true); + public void testAllFilesPresentInHighlighter() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/highlighter"), Pattern.compile("^(.+)\\.kt$"), null, true); } - @TestMetadata("Class.kt") - public void testClass() throws Exception { - runTest("idea/testData/highlighter/deprecated/Class.kt"); + @TestMetadata("Annotations.kt") + public void testAnnotations() throws Exception { + runTest("idea/testData/highlighter/Annotations.kt"); } - @TestMetadata("ClassObject.kt") - public void testClassObject() throws Exception { - runTest("idea/testData/highlighter/deprecated/ClassObject.kt"); + @TestMetadata("AutoCreatedItParameter.kt") + public void testAutoCreatedItParameter() throws Exception { + runTest("idea/testData/highlighter/AutoCreatedItParameter.kt"); } - @TestMetadata("Constructor.kt") - public void testConstructor() throws Exception { - runTest("idea/testData/highlighter/deprecated/Constructor.kt"); + @TestMetadata("Destructuring.kt") + public void testDestructuring() throws Exception { + runTest("idea/testData/highlighter/Destructuring.kt"); } - @TestMetadata("ExtensionFunction.kt") - public void testExtensionFunction() throws Exception { - runTest("idea/testData/highlighter/deprecated/ExtensionFunction.kt"); + @TestMetadata("Dynamic.kt") + public void testDynamic() throws Exception { + runTest("idea/testData/highlighter/Dynamic.kt"); } - @TestMetadata("Function.kt") - public void testFunction() throws Exception { - runTest("idea/testData/highlighter/deprecated/Function.kt"); + @TestMetadata("Enums.kt") + public void testEnums() throws Exception { + runTest("idea/testData/highlighter/Enums.kt"); } - @TestMetadata("Get.kt") - public void testGet() throws Exception { - runTest("idea/testData/highlighter/deprecated/Get.kt"); + @TestMetadata("Field.kt") + public void testField() throws Exception { + runTest("idea/testData/highlighter/Field.kt"); } - @TestMetadata("Getter.kt") - public void testGetter() throws Exception { - runTest("idea/testData/highlighter/deprecated/Getter.kt"); + @TestMetadata("Functions.kt") + public void testFunctions() throws Exception { + runTest("idea/testData/highlighter/Functions.kt"); } - @TestMetadata("Inc.kt") - public void testInc() throws Exception { - runTest("idea/testData/highlighter/deprecated/Inc.kt"); + @TestMetadata("InvokeCall.kt") + public void testInvokeCall() throws Exception { + runTest("idea/testData/highlighter/InvokeCall.kt"); } - @TestMetadata("Invalid.kt") - public void testInvalid() throws Exception { - runTest("idea/testData/highlighter/deprecated/Invalid.kt"); + @TestMetadata("JavaTypes.kt") + public void testJavaTypes() throws Exception { + runTest("idea/testData/highlighter/JavaTypes.kt"); } - @TestMetadata("Invoke.kt") - public void testInvoke() throws Exception { - runTest("idea/testData/highlighter/deprecated/Invoke.kt"); + @TestMetadata("KDoc.kt") + public void testKDoc() throws Exception { + runTest("idea/testData/highlighter/KDoc.kt"); } - @TestMetadata("Operation.kt") - public void testOperation() throws Exception { - runTest("idea/testData/highlighter/deprecated/Operation.kt"); + @TestMetadata("KotlinInjection.kt") + public void testKotlinInjection() throws Exception { + runTest("idea/testData/highlighter/KotlinInjection.kt"); } - @TestMetadata("Property.kt") - public void testProperty() throws Exception { - runTest("idea/testData/highlighter/deprecated/Property.kt"); + @TestMetadata("Labels.kt") + public void testLabels() throws Exception { + runTest("idea/testData/highlighter/Labels.kt"); } - @TestMetadata("RangeTo.kt") - public void testRangeTo() throws Exception { - runTest("idea/testData/highlighter/deprecated/RangeTo.kt"); + @TestMetadata("NamedArguments.kt") + public void testNamedArguments() throws Exception { + runTest("idea/testData/highlighter/NamedArguments.kt"); } - @TestMetadata("Setter.kt") - public void testSetter() throws Exception { - runTest("idea/testData/highlighter/deprecated/Setter.kt"); + @TestMetadata("NonNullAssertion.kt") + public void testNonNullAssertion() throws Exception { + runTest("idea/testData/highlighter/NonNullAssertion.kt"); } - @TestMetadata("SuperCall.kt") - public void testSuperCall() throws Exception { - runTest("idea/testData/highlighter/deprecated/SuperCall.kt"); + @TestMetadata("Object.kt") + public void testObject() throws Exception { + runTest("idea/testData/highlighter/Object.kt"); } - @TestMetadata("Trait.kt") - public void testTrait() throws Exception { - runTest("idea/testData/highlighter/deprecated/Trait.kt"); + @TestMetadata("PropertiesWithPropertyDeclarations.kt") + public void testPropertiesWithPropertyDeclarations() throws Exception { + runTest("idea/testData/highlighter/PropertiesWithPropertyDeclarations.kt"); + } + + @TestMetadata("SmartCast.kt") + public void testSmartCast() throws Exception { + runTest("idea/testData/highlighter/SmartCast.kt"); + } + + @TestMetadata("Suspend.kt") + public void testSuspend() throws Exception { + runTest("idea/testData/highlighter/Suspend.kt"); + } + + @TestMetadata("SyntheticExtensionProperty.kt") + public void testSyntheticExtensionProperty() throws Exception { + runTest("idea/testData/highlighter/SyntheticExtensionProperty.kt"); + } + + @TestMetadata("Todo.kt") + public void testTodo() throws Exception { + runTest("idea/testData/highlighter/Todo.kt"); + } + + @TestMetadata("TopLevelDestructuring.kt") + public void testTopLevelDestructuring() throws Exception { + runTest("idea/testData/highlighter/TopLevelDestructuring.kt"); + } + + @TestMetadata("TopLevelOpenSuspendFun.kt") + public void testTopLevelOpenSuspendFun() throws Exception { + runTest("idea/testData/highlighter/TopLevelOpenSuspendFun.kt"); + } + + @TestMetadata("TypeAlias.kt") + public void testTypeAlias() throws Exception { + runTest("idea/testData/highlighter/TypeAlias.kt"); + } + + @TestMetadata("TypesAndAnnotations.kt") + public void testTypesAndAnnotations() throws Exception { + runTest("idea/testData/highlighter/TypesAndAnnotations.kt"); + } + + @TestMetadata("Variables.kt") + public void testVariables() throws Exception { + runTest("idea/testData/highlighter/Variables.kt"); + } + + @TestMetadata("VariablesAsFunctions.kt") + public void testVariablesAsFunctions() throws Exception { + runTest("idea/testData/highlighter/VariablesAsFunctions.kt"); + } + + @TestMetadata("idea/testData/highlighter/deprecated") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Deprecated extends AbstractFirHighlightingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDeprecated() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/testData/highlighter/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("Class.kt") + public void testClass() throws Exception { + runTest("idea/testData/highlighter/deprecated/Class.kt"); + } + + @TestMetadata("ClassObject.kt") + public void testClassObject() throws Exception { + runTest("idea/testData/highlighter/deprecated/ClassObject.kt"); + } + + @TestMetadata("Constructor.kt") + public void testConstructor() throws Exception { + runTest("idea/testData/highlighter/deprecated/Constructor.kt"); + } + + @TestMetadata("ExtensionFunction.kt") + public void testExtensionFunction() throws Exception { + runTest("idea/testData/highlighter/deprecated/ExtensionFunction.kt"); + } + + @TestMetadata("Function.kt") + public void testFunction() throws Exception { + runTest("idea/testData/highlighter/deprecated/Function.kt"); + } + + @TestMetadata("Get.kt") + public void testGet() throws Exception { + runTest("idea/testData/highlighter/deprecated/Get.kt"); + } + + @TestMetadata("Getter.kt") + public void testGetter() throws Exception { + runTest("idea/testData/highlighter/deprecated/Getter.kt"); + } + + @TestMetadata("Inc.kt") + public void testInc() throws Exception { + runTest("idea/testData/highlighter/deprecated/Inc.kt"); + } + + @TestMetadata("Invalid.kt") + public void testInvalid() throws Exception { + runTest("idea/testData/highlighter/deprecated/Invalid.kt"); + } + + @TestMetadata("Invoke.kt") + public void testInvoke() throws Exception { + runTest("idea/testData/highlighter/deprecated/Invoke.kt"); + } + + @TestMetadata("Operation.kt") + public void testOperation() throws Exception { + runTest("idea/testData/highlighter/deprecated/Operation.kt"); + } + + @TestMetadata("Property.kt") + public void testProperty() throws Exception { + runTest("idea/testData/highlighter/deprecated/Property.kt"); + } + + @TestMetadata("RangeTo.kt") + public void testRangeTo() throws Exception { + runTest("idea/testData/highlighter/deprecated/RangeTo.kt"); + } + + @TestMetadata("Setter.kt") + public void testSetter() throws Exception { + runTest("idea/testData/highlighter/deprecated/Setter.kt"); + } + + @TestMetadata("SuperCall.kt") + public void testSuperCall() throws Exception { + runTest("idea/testData/highlighter/deprecated/SuperCall.kt"); + } + + @TestMetadata("Trait.kt") + public void testTrait() throws Exception { + runTest("idea/testData/highlighter/deprecated/Trait.kt"); + } + } + } + + @TestMetadata("idea/idea-fir/testData/highlighterFir") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class HighlighterFir extends AbstractFirHighlightingTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInHighlighterFir() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-fir/testData/highlighterFir"), Pattern.compile("^([^.]+)\\.kt$"), null, true); + } + + @TestMetadata("consturctor.kt") + public void testConsturctor() throws Exception { + runTest("idea/idea-fir/testData/highlighterFir/consturctor.kt"); + } + + @TestMetadata("extensionProperty.kt") + public void testExtensionProperty() throws Exception { + runTest("idea/idea-fir/testData/highlighterFir/extensionProperty.kt"); + } + + @TestMetadata("withCall.kt") + public void testWithCall() throws Exception { + runTest("idea/idea-fir/testData/highlighterFir/withCall.kt"); } } }