From 299f36183cc99f1bdc04e42ecc860b556fbc4b5c Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Sat, 12 Dec 2020 14:44:51 +0100 Subject: [PATCH] FIR IDE: add tests for completion weighers from old testdata --- .../kotlin/generators/tests/GenerateTests.kt | 5 + .../testData/weighers/basic/Prefix.kt | 2 + .../basic/expectedInfo/ExpectedType2.kt | 2 + .../weighers/AbstractCompletionWeigherTest.kt | 12 +- .../wheigher/AbstractHighLevelWeigherTest.kt | 21 + .../HighLevelWeigherTestGenerated.java | 535 ++++++++++++++++++ 6 files changed, 574 insertions(+), 3 deletions(-) create mode 100644 idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/wheigher/AbstractHighLevelWeigherTest.kt create mode 100644 idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/wheigher/HighLevelWeigherTestGenerated.java diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index dbb2203c252..727a4c200ab 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -51,6 +51,7 @@ import org.jetbrains.kotlin.idea.completion.test.* import org.jetbrains.kotlin.idea.completion.test.handlers.* import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractBasicCompletionWeigherTest import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractSmartCompletionWeigherTest +import org.jetbrains.kotlin.idea.completion.wheigher.AbstractHighLevelWeigherTest import org.jetbrains.kotlin.idea.configuration.AbstractGradleConfigureProjectByChangingFileTest import org.jetbrains.kotlin.idea.conversion.copy.AbstractJavaToKotlinCopyPasteConversionTest import org.jetbrains.kotlin.idea.conversion.copy.AbstractLiteralKotlinToKotlinCopyPasteTest @@ -1102,6 +1103,10 @@ fun main(args: Array) { testClass { model("handlers/basic", pattern = KT_WITHOUT_DOTS_IN_NAME) } + + testClass { + model("weighers/basic", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) + } } testGroup("idea/idea-fir/tests", "idea/testData/findUsages") { diff --git a/idea/idea-completion/testData/weighers/basic/Prefix.kt b/idea/idea-completion/testData/weighers/basic/Prefix.kt index c6122d64830..0efe810d78d 100644 --- a/idea/idea-completion/testData/weighers/basic/Prefix.kt +++ b/idea/idea-completion/testData/weighers/basic/Prefix.kt @@ -1,3 +1,5 @@ +// FIR_COMPARISON + fun shouldCompleteTopLevelCallablesFromIndex() = true fun foo(statement: String) { diff --git a/idea/idea-completion/testData/weighers/basic/expectedInfo/ExpectedType2.kt b/idea/idea-completion/testData/weighers/basic/expectedInfo/ExpectedType2.kt index 0c98ee4ec12..b259f83697b 100644 --- a/idea/idea-completion/testData/weighers/basic/expectedInfo/ExpectedType2.kt +++ b/idea/idea-completion/testData/weighers/basic/expectedInfo/ExpectedType2.kt @@ -1,3 +1,5 @@ +// FIR_COMPARISON + interface I { fun takeXxx(): Int = 0 fun takeYyy(): String = "" diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/weighers/AbstractCompletionWeigherTest.kt b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/weighers/AbstractCompletionWeigherTest.kt index a03e1a038fa..ab64416ab73 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/weighers/AbstractCompletionWeigherTest.kt +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/weighers/AbstractCompletionWeigherTest.kt @@ -28,11 +28,17 @@ abstract class AbstractCompletionWeigherTest(val completionType: CompletionType, val items = InTextDirectivesUtils.findArrayWithPrefixes(text, "// ORDER:") Assert.assertTrue("""Some items should be defined with "// ORDER:" directive""", items.isNotEmpty()) - withCustomCompilerOptions(text, project, module) { - myFixture.complete(completionType, InTextDirectivesUtils.getPrefixedInt(text, "// INVOCATION_COUNT:") ?: 1) - myFixture.assertPreferredCompletionItems(InTextDirectivesUtils.getPrefixedInt(text, "// SELECTED:") ?: 0, *items) + executeTest { + withCustomCompilerOptions(text, project, module) { + myFixture.complete(completionType, InTextDirectivesUtils.getPrefixedInt(text, "// INVOCATION_COUNT:") ?: 1) + myFixture.assertPreferredCompletionItems(InTextDirectivesUtils.getPrefixedInt(text, "// SELECTED:") ?: 0, *items) + } } } + + open fun executeTest(test: () -> Unit) { + test() + } } abstract class AbstractBasicCompletionWeigherTest() : AbstractCompletionWeigherTest(CompletionType.BASIC, "weighers/basic") { diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/wheigher/AbstractHighLevelWeigherTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/wheigher/AbstractHighLevelWeigherTest.kt new file mode 100644 index 00000000000..b778763bd22 --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/wheigher/AbstractHighLevelWeigherTest.kt @@ -0,0 +1,21 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.completion.wheigher + +import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractBasicCompletionWeigherTest +import org.jetbrains.kotlin.test.uitls.IgnoreTests + +abstract class AbstractHighLevelWeigherTest : AbstractBasicCompletionWeigherTest() { + override fun isFirPlugin(): Boolean = true + + override val captureExceptions: Boolean = false + + override fun executeTest(test: () -> Unit) { + IgnoreTests.runTestIfEnabledByFileDirective(testDataFile().toPath(), IgnoreTests.DIRECTIVES.FIR_COMPARISON, ".after") { + test() + } + } +} \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/wheigher/HighLevelWeigherTestGenerated.java b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/wheigher/HighLevelWeigherTestGenerated.java new file mode 100644 index 00000000000..1db3ed5d37a --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/wheigher/HighLevelWeigherTestGenerated.java @@ -0,0 +1,535 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.completion.wheigher; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +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/idea-completion/testData/weighers/basic") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class HighLevelWeigherTestGenerated extends AbstractHighLevelWeigherTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("AfterNullable.kt") + public void testAfterNullable() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/AfterNullable.kt"); + } + + public void testAllFilesPresentInBasic() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/weighers/basic"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true); + } + + @TestMetadata("CallableReference_NothingLast.kt") + public void testCallableReference_NothingLast() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/CallableReference_NothingLast.kt"); + } + + @TestMetadata("Callables.kt") + public void testCallables() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/Callables.kt"); + } + + @TestMetadata("DelegateToOtherObject.kt") + public void testDelegateToOtherObject() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/DelegateToOtherObject.kt"); + } + + @TestMetadata("DeprecatedFun.kt") + public void testDeprecatedFun() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/DeprecatedFun.kt"); + } + + @TestMetadata("DeprecatedJavaClass.kt") + public void testDeprecatedJavaClass() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/DeprecatedJavaClass.kt"); + } + + @TestMetadata("DeprecatedSinceKotlinFun.kt") + public void testDeprecatedSinceKotlinFun() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/DeprecatedSinceKotlinFun.kt"); + } + + @TestMetadata("DslCallWithExpectedType.kt") + public void testDslCallWithExpectedType() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/DslCallWithExpectedType.kt"); + } + + @TestMetadata("DslCalls.kt") + public void testDslCalls() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/DslCalls.kt"); + } + + @TestMetadata("DslCallsAnnotatedFunctionType.kt") + public void testDslCallsAnnotatedFunctionType() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/DslCallsAnnotatedFunctionType.kt"); + } + + @TestMetadata("DslCallsWithMultipleReceivers.kt") + public void testDslCallsWithMultipleReceivers() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/DslCallsWithMultipleReceivers.kt"); + } + + @TestMetadata("DslMemberCalls.kt") + public void testDslMemberCalls() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/DslMemberCalls.kt"); + } + + @TestMetadata("ExactMatchForKeyword.kt") + public void testExactMatchForKeyword() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/ExactMatchForKeyword.kt"); + } + + @TestMetadata("ImportedFirst.kt") + public void testImportedFirst() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/ImportedFirst.kt"); + } + + @TestMetadata("ImportedFirstForJavaClass.kt") + public void testImportedFirstForJavaClass() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/ImportedFirstForJavaClass.kt"); + } + + @TestMetadata("ImportedOrder.kt") + public void testImportedOrder() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/ImportedOrder.kt"); + } + + @TestMetadata("KT-25588_1.kts") + public void testKT_25588_1() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/KT-25588_1.kts"); + } + + @TestMetadata("KT-25588_2.kts") + public void testKT_25588_2() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/KT-25588_2.kts"); + } + + @TestMetadata("KeywordsLast.kt") + public void testKeywordsLast() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/KeywordsLast.kt"); + } + + @TestMetadata("LambdaSignature.kt") + public void testLambdaSignature() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/LambdaSignature.kt"); + } + + @TestMetadata("LocalFileBeforeImported.kt") + public void testLocalFileBeforeImported() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/LocalFileBeforeImported.kt"); + } + + @TestMetadata("LocalValuesAndParams.kt") + public void testLocalValuesAndParams() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/LocalValuesAndParams.kt"); + } + + @TestMetadata("LocalsBeforeKeywords.kt") + public void testLocalsBeforeKeywords() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/LocalsBeforeKeywords.kt"); + } + + @TestMetadata("LocalsPropertiesKeywords.kt") + public void testLocalsPropertiesKeywords() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/LocalsPropertiesKeywords.kt"); + } + + @TestMetadata("NamedParameters.kt") + public void testNamedParameters() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/NamedParameters.kt"); + } + + @TestMetadata("NamedParameters2.kt") + public void testNamedParameters2() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/NamedParameters2.kt"); + } + + @TestMetadata("NamedParameters3.kt") + public void testNamedParameters3() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/NamedParameters3.kt"); + } + + @TestMetadata("NoExpectedType.kt") + public void testNoExpectedType() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/NoExpectedType.kt"); + } + + @TestMetadata("Packages.kt") + public void testPackages() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/Packages.kt"); + } + + @TestMetadata("ParametersBeforeKeywords.kt") + public void testParametersBeforeKeywords() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/ParametersBeforeKeywords.kt"); + } + + @TestMetadata("PreferFromJdk.kt") + public void testPreferFromJdk() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/PreferFromJdk.kt"); + } + + @TestMetadata("PreferGetMethodToProperty.kt") + public void testPreferGetMethodToProperty() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/PreferGetMethodToProperty.kt"); + } + + @TestMetadata("Prefix.kt") + public void testPrefix() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/Prefix.kt"); + } + + @TestMetadata("PropertiesBeforeKeywords.kt") + public void testPropertiesBeforeKeywords() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/PropertiesBeforeKeywords.kt"); + } + + @TestMetadata("StaticMembers.kt") + public void testStaticMembers() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/StaticMembers.kt"); + } + + @TestMetadata("SuperMembers.kt") + public void testSuperMembers() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/SuperMembers.kt"); + } + + @TestMetadata("TopLevelKeywordWithClassName.kt") + public void testTopLevelKeywordWithClassName() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/TopLevelKeywordWithClassName.kt"); + } + + @TestMetadata("UnavailableDslReceiver.kt") + public void testUnavailableDslReceiver() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/UnavailableDslReceiver.kt"); + } + + @TestMetadata("idea/idea-completion/testData/weighers/basic/contextualReturn") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ContextualReturn extends AbstractHighLevelWeigherTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInContextualReturn() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/weighers/basic/contextualReturn"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true); + } + + @TestMetadata("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NoReturnType extends AbstractHighLevelWeigherTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInNoReturnType() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true); + } + + @TestMetadata("BeginOfNestedBlock.kt") + public void testBeginOfNestedBlock() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/BeginOfNestedBlock.kt"); + } + + @TestMetadata("BeginOfTopLevelBlock.kt") + public void testBeginOfTopLevelBlock() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/BeginOfTopLevelBlock.kt"); + } + + @TestMetadata("EndOfNestedBlock.kt") + public void testEndOfNestedBlock() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/EndOfNestedBlock.kt"); + } + + @TestMetadata("EndOfTopLevelBlock.kt") + public void testEndOfTopLevelBlock() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/EndOfTopLevelBlock.kt"); + } + + @TestMetadata("ForWithBody.kt") + public void testForWithBody() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/ForWithBody.kt"); + } + + @TestMetadata("ForWithoutBody.kt") + public void testForWithoutBody() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/ForWithoutBody.kt"); + } + + @TestMetadata("IfWithoutBody.kt") + public void testIfWithoutBody() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/IfWithoutBody.kt"); + } + + @TestMetadata("InElvis.kt") + public void testInElvis() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/InElvis.kt"); + } + + @TestMetadata("InElvisWhenSmartCompletionWins.kt") + public void testInElvisWhenSmartCompletionWins() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/InElvisWhenSmartCompletionWins.kt"); + } + + @TestMetadata("InWhenSingleExpression.kt") + public void testInWhenSingleExpression() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/InWhenSingleExpression.kt"); + } + + @TestMetadata("InWhenWithBody.kt") + public void testInWhenWithBody() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/noReturnType/InWhenWithBody.kt"); + } + } + + @TestMetadata("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class WithReturnType extends AbstractHighLevelWeigherTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInWithReturnType() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true); + } + + @TestMetadata("BeginOfNestedBlock.kt") + public void testBeginOfNestedBlock() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/BeginOfNestedBlock.kt"); + } + + @TestMetadata("BeginOfTopLevelBlock.kt") + public void testBeginOfTopLevelBlock() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/BeginOfTopLevelBlock.kt"); + } + + @TestMetadata("EndOfNestedBlock.kt") + public void testEndOfNestedBlock() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/EndOfNestedBlock.kt"); + } + + @TestMetadata("EndOfTopLevelBlock.kt") + public void testEndOfTopLevelBlock() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/EndOfTopLevelBlock.kt"); + } + + @TestMetadata("ForWithBody.kt") + public void testForWithBody() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/ForWithBody.kt"); + } + + @TestMetadata("ForWithoutBody.kt") + public void testForWithoutBody() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/ForWithoutBody.kt"); + } + + @TestMetadata("IfWithoutBody.kt") + public void testIfWithoutBody() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/IfWithoutBody.kt"); + } + + @TestMetadata("InElvis.kt") + public void testInElvis() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/InElvis.kt"); + } + + @TestMetadata("InElvisInReturn.kt") + public void testInElvisInReturn() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/InElvisInReturn.kt"); + } + + @TestMetadata("InElvisWhenSmartCompletionWins.kt") + public void testInElvisWhenSmartCompletionWins() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/InElvisWhenSmartCompletionWins.kt"); + } + + @TestMetadata("InIfAsReturnedExpression.kt") + public void testInIfAsReturnedExpression() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/InIfAsReturnedExpression.kt"); + } + + @TestMetadata("InIfInWhenWithBodyAsReturnedExpression.kt") + public void testInIfInWhenWithBodyAsReturnedExpression() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/InIfInWhenWithBodyAsReturnedExpression.kt"); + } + + @TestMetadata("InNotElvisBinaryOperator.kt") + public void testInNotElvisBinaryOperator() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/InNotElvisBinaryOperator.kt"); + } + + @TestMetadata("InWhenAsReturnedExpression.kt") + public void testInWhenAsReturnedExpression() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/InWhenAsReturnedExpression.kt"); + } + + @TestMetadata("InWhenSingleExpression.kt") + public void testInWhenSingleExpression() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/InWhenSingleExpression.kt"); + } + + @TestMetadata("InWhenWithBody.kt") + public void testInWhenWithBody() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/InWhenWithBody.kt"); + } + + @TestMetadata("InWhenWithBodyAsReturnedExpression.kt") + public void testInWhenWithBodyAsReturnedExpression() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/contextualReturn/withReturnType/InWhenWithBodyAsReturnedExpression.kt"); + } + } + } + + @TestMetadata("idea/idea-completion/testData/weighers/basic/expectedInfo") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ExpectedInfo extends AbstractHighLevelWeigherTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("AfterAs.kt") + public void testAfterAs() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/AfterAs.kt"); + } + + public void testAllFilesPresentInExpectedInfo() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/weighers/basic/expectedInfo"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true); + } + + @TestMetadata("CompanionObjectMethod.kt") + public void testCompanionObjectMethod() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/CompanionObjectMethod.kt"); + } + + @TestMetadata("EnumEntries.kt") + public void testEnumEntries() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/EnumEntries.kt"); + } + + @TestMetadata("ExpectedType.kt") + public void testExpectedType() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/ExpectedType.kt"); + } + + @TestMetadata("ExpectedType2.kt") + public void testExpectedType2() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/ExpectedType2.kt"); + } + + @TestMetadata("LambdaValue.kt") + public void testLambdaValue() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/LambdaValue.kt"); + } + + @TestMetadata("MultiArgsItem.kt") + public void testMultiArgsItem() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/MultiArgsItem.kt"); + } + + @TestMetadata("NameSimilarity.kt") + public void testNameSimilarity() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/NameSimilarity.kt"); + } + + @TestMetadata("NameSimilarityAndNoExpectedType.kt") + public void testNameSimilarityAndNoExpectedType() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/NameSimilarityAndNoExpectedType.kt"); + } + + @TestMetadata("NameSimilarityAndNoExpectedType2.kt") + public void testNameSimilarityAndNoExpectedType2() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/NameSimilarityAndNoExpectedType2.kt"); + } + + @TestMetadata("NoStupidComparison.kt") + public void testNoStupidComparison() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/NoStupidComparison.kt"); + } + + @TestMetadata("Null.kt") + public void testNull() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/Null.kt"); + } + + @TestMetadata("PreferMatchingThis.kt") + public void testPreferMatchingThis() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/PreferMatchingThis.kt"); + } + + @TestMetadata("TrueFalse.kt") + public void testTrueFalse() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/TrueFalse.kt"); + } + + @TestMetadata("WhenByEnum.kt") + public void testWhenByEnum() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/expectedInfo/WhenByEnum.kt"); + } + } + + @TestMetadata("idea/idea-completion/testData/weighers/basic/parameterNameAndType") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ParameterNameAndType extends AbstractHighLevelWeigherTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInParameterNameAndType() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/weighers/basic/parameterNameAndType"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true); + } + + @TestMetadata("Deprecated.kt") + public void testDeprecated() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/parameterNameAndType/Deprecated.kt"); + } + + @TestMetadata("FromCurrentFilePriority.kt") + public void testFromCurrentFilePriority() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/parameterNameAndType/FromCurrentFilePriority.kt"); + } + + @TestMetadata("ImportedFirst.kt") + public void testImportedFirst() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/parameterNameAndType/ImportedFirst.kt"); + } + + @TestMetadata("MoreWordsMatchFirst.kt") + public void testMoreWordsMatchFirst() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/parameterNameAndType/MoreWordsMatchFirst.kt"); + } + + @TestMetadata("ShorterFirst.kt") + public void testShorterFirst() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/parameterNameAndType/ShorterFirst.kt"); + } + + @TestMetadata("StartMatchFirst.kt") + public void testStartMatchFirst() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/parameterNameAndType/StartMatchFirst.kt"); + } + + @TestMetadata("UserPrefix.kt") + public void testUserPrefix() throws Exception { + runTest("idea/idea-completion/testData/weighers/basic/parameterNameAndType/UserPrefix.kt"); + } + } +}