FIR IDE: add completion weighers tests for return/if/while
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
// FIR_COMPARISON
|
||||
|
||||
object x {
|
||||
val b: Boolean = true
|
||||
val c: String = "true"
|
||||
val d: Int = 1
|
||||
val e: Long = 1L
|
||||
val f: Boolean = true
|
||||
|
||||
fun foo(): Boolean = true
|
||||
}
|
||||
|
||||
|
||||
fun test() {
|
||||
if(x.<caret>){
|
||||
}
|
||||
|
||||
// ORDER: b, f, foo
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
val b: Boolean = true
|
||||
val c: String = "true"
|
||||
val d: Int = 1
|
||||
val e: Long = 1L
|
||||
val f: Boolean = true
|
||||
|
||||
fun foo(): Boolean
|
||||
|
||||
fun test(): Int {
|
||||
return <caret>
|
||||
}
|
||||
|
||||
//ORDER: test, d
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// FIR_COMPARISON
|
||||
|
||||
object x {
|
||||
val b: Boolean = true
|
||||
val c: String = "true"
|
||||
val d: Int = 1
|
||||
val e: Long = 1L
|
||||
val f: Boolean = true
|
||||
|
||||
fun foo(): Int
|
||||
}
|
||||
|
||||
fun test(): Int {
|
||||
return x.<caret>
|
||||
}
|
||||
|
||||
//ORDER: d, foo, f
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// FIR_COMPARISON
|
||||
|
||||
val a: Int
|
||||
val b: String
|
||||
val c: Long
|
||||
val d: Int
|
||||
|
||||
fun test(): Int {
|
||||
receiveLambda {
|
||||
return@receiveLambda <caret>
|
||||
}
|
||||
return 2
|
||||
}
|
||||
|
||||
fun receiveLambda(x: () -> Int){}
|
||||
|
||||
// ORDER: a, d, test
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// FIR_COMPARISON
|
||||
|
||||
object x {
|
||||
val b: Boolean = true
|
||||
val c: String = "true"
|
||||
val d: Int = 1
|
||||
val e: Long = 1L
|
||||
val f: Boolean = true
|
||||
|
||||
fun foo(): Boolean = true
|
||||
}
|
||||
|
||||
|
||||
fun x() {
|
||||
while(x.<caret>){
|
||||
}
|
||||
|
||||
// ORDER: b, f, foo
|
||||
+38
@@ -485,6 +485,44 @@ public class BasicCompletionWeigherTestGenerated extends AbstractBasicCompletion
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/idea-completion/testData/weighers/basic/expectedType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ExpectedType extends AbstractBasicCompletionWeigherTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInExpectedType() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/weighers/basic/expectedType"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("ifConditionQualified.kt")
|
||||
public void testIfConditionQualified() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/expectedType/ifConditionQualified.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnFromFunction.kt")
|
||||
public void testReturnFromFunction() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/expectedType/returnFromFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnFromFunctionQualifiedSelector.kt")
|
||||
public void testReturnFromFunctionQualifiedSelector() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/expectedType/returnFromFunctionQualifiedSelector.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnFromLambda.kt")
|
||||
public void testReturnFromLambda() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/expectedType/returnFromLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whileConditionQualified.kt")
|
||||
public void testWhileConditionQualified() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/expectedType/whileConditionQualified.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/idea-completion/testData/weighers/basic/parameterNameAndType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
idea/idea-fir/tests/org/jetbrains/kotlin/idea/completion/wheigher/HighLevelWeigherTestGenerated.java
Generated
+38
@@ -485,6 +485,44 @@ public class HighLevelWeigherTestGenerated extends AbstractHighLevelWeigherTest
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/idea-completion/testData/weighers/basic/expectedType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ExpectedType extends AbstractHighLevelWeigherTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInExpectedType() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-completion/testData/weighers/basic/expectedType"), Pattern.compile("^([^.]+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("ifConditionQualified.kt")
|
||||
public void testIfConditionQualified() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/expectedType/ifConditionQualified.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnFromFunction.kt")
|
||||
public void testReturnFromFunction() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/expectedType/returnFromFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnFromFunctionQualifiedSelector.kt")
|
||||
public void testReturnFromFunctionQualifiedSelector() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/expectedType/returnFromFunctionQualifiedSelector.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnFromLambda.kt")
|
||||
public void testReturnFromLambda() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/expectedType/returnFromLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whileConditionQualified.kt")
|
||||
public void testWhileConditionQualified() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/expectedType/whileConditionQualified.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/idea-completion/testData/weighers/basic/parameterNameAndType")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user