From 59b22fadaddb3f43a0a8c7523b896736ad32eff4 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 27 May 2021 15:18:55 +0200 Subject: [PATCH] FIR IDE: add tests for completion where clause --- .../where/noCompletionAfterDotInWhen.kt | 4 +++ .../basic/common/where/whereInClass.kt | 7 +++++ .../basic/common/where/whereInFunction.kt | 7 +++++ ...hLevelJvmBasicCompletionTestGenerated.java | 28 +++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 idea/idea-fir/testData/completion/basic/common/where/noCompletionAfterDotInWhen.kt create mode 100644 idea/idea-fir/testData/completion/basic/common/where/whereInClass.kt create mode 100644 idea/idea-fir/testData/completion/basic/common/where/whereInFunction.kt diff --git a/idea/idea-fir/testData/completion/basic/common/where/noCompletionAfterDotInWhen.kt b/idea/idea-fir/testData/completion/basic/common/where/noCompletionAfterDotInWhen.kt new file mode 100644 index 00000000000..2b011750b74 --- /dev/null +++ b/idea/idea-fir/testData/completion/basic/common/where/noCompletionAfterDotInWhen.kt @@ -0,0 +1,4 @@ +fun foo() where T. + +// NOTHING_ELSE +// FIR_COMPARISON diff --git a/idea/idea-fir/testData/completion/basic/common/where/whereInClass.kt b/idea/idea-fir/testData/completion/basic/common/where/whereInClass.kt new file mode 100644 index 00000000000..dab56ab5b03 --- /dev/null +++ b/idea/idea-fir/testData/completion/basic/common/where/whereInClass.kt @@ -0,0 +1,7 @@ +class X() where + + +// EXIST: T +// EXIST: K +// NOTHING_ELSE +// FIR_COMPARISON diff --git a/idea/idea-fir/testData/completion/basic/common/where/whereInFunction.kt b/idea/idea-fir/testData/completion/basic/common/where/whereInFunction.kt new file mode 100644 index 00000000000..fd6c5294d50 --- /dev/null +++ b/idea/idea-fir/testData/completion/basic/common/where/whereInFunction.kt @@ -0,0 +1,7 @@ +fun foo() where + + +// EXIST: T +// EXIST: K +// NOTHING_ELSE +// FIR_COMPARISON diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/fir/completion/HighLevelJvmBasicCompletionTestGenerated.java b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/fir/completion/HighLevelJvmBasicCompletionTestGenerated.java index 6427b207bfb..c4f19f4bc81 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/fir/completion/HighLevelJvmBasicCompletionTestGenerated.java +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/fir/completion/HighLevelJvmBasicCompletionTestGenerated.java @@ -3412,5 +3412,33 @@ public class HighLevelJvmBasicCompletionTestGenerated extends AbstractHighLevelJ runTest("idea/idea-completion/testData/../../idea-fir/testData/completion/basic/common/when/sealedInterfaceInWhen.kt"); } } + + @TestMetadata("idea/idea-completion/testData/../../idea-fir/testData/completion/basic/common/where") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Where extends AbstractHighLevelJvmBasicCompletionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInWhere() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/../../idea-fir/testData/completion/basic/common/where"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("noCompletionAfterDotInWhen.kt") + public void testNoCompletionAfterDotInWhen() throws Exception { + runTest("idea/idea-completion/testData/../../idea-fir/testData/completion/basic/common/where/noCompletionAfterDotInWhen.kt"); + } + + @TestMetadata("whereInClass.kt") + public void testWhereInClass() throws Exception { + runTest("idea/idea-completion/testData/../../idea-fir/testData/completion/basic/common/where/whereInClass.kt"); + } + + @TestMetadata("whereInFunction.kt") + public void testWhereInFunction() throws Exception { + runTest("idea/idea-completion/testData/../../idea-fir/testData/completion/basic/common/where/whereInFunction.kt"); + } + } } }