FIR IDE: add test for super keyword completion with qualifier

This commit is contained in:
Ilya Kirillov
2021-05-19 16:09:27 +02:00
committed by TeamCityServer
parent 0a6243fc67
commit 48b69b4f3f
3 changed files with 628 additions and 588 deletions
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.generators.TestGroup
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil import org.jetbrains.kotlin.generators.util.TestGeneratorUtil
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_WITHOUT_FIR_PREFIX
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS_WITHOUT_DOTS_IN_NAME import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS_WITHOUT_DOTS_IN_NAME
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME
import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest
@@ -1217,6 +1218,12 @@ fun main(args: Array<String>) {
testClass<AbstractFirKeywordCompletionTest> { testClass<AbstractFirKeywordCompletionTest> {
model("keywords", recursive = false, pattern = KT_WITHOUT_FIR_PREFIX) model("keywords", recursive = false, pattern = KT_WITHOUT_FIR_PREFIX)
model(
"../../idea-fir/testData/completion/keywords",
testClassName = "KeywordsFir",
recursive = false,
pattern = KT_WITHOUT_FIR_PREFIX
)
} }
} }
@@ -0,0 +1,12 @@
// FIR_IDENTICAL
// FIR_COMPARISON
class X: List<Int>, Comparable<Int> {
init {
sup<caret>
}
}
// EXIST: super
// EXIST: super<List>
// EXIST: super<Comparable>
// NOTHING_ELSE
@@ -17,10 +17,12 @@ 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 org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all") @SuppressWarnings("all")
@RunWith(JUnit3RunnerWithInners.class)
public class FirKeywordCompletionTestGenerated extends AbstractFirKeywordCompletionTest {
@TestMetadata("idea/idea-completion/testData/keywords") @TestMetadata("idea/idea-completion/testData/keywords")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
public class FirKeywordCompletionTestGenerated extends AbstractFirKeywordCompletionTest { public static class Keywords extends AbstractFirKeywordCompletionTest {
private void runTest(String testDataFilePath) throws Exception { private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
} }
@@ -609,3 +611,22 @@ public class FirKeywordCompletionTestGenerated extends AbstractFirKeywordComplet
runTest("idea/idea-completion/testData/keywords/UseSiteTargetForPrimaryConstructorParameter.kt"); runTest("idea/idea-completion/testData/keywords/UseSiteTargetForPrimaryConstructorParameter.kt");
} }
} }
@TestMetadata("idea/idea-completion/testData/../../idea-fir/testData/completion/keywords")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class KeywordsFir extends AbstractFirKeywordCompletionTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInKeywordsFir() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/../../idea-fir/testData/completion/keywords"), Pattern.compile("^(.+)(?<!\\.fir)\\.kt$"), null, false);
}
@TestMetadata("superWithQualifier.kt")
public void testSuperWithQualifier() throws Exception {
runTest("idea/idea-completion/testData/../../idea-fir/testData/completion/keywords/superWithQualifier.kt");
}
}
}