FIR IDE: add tests for completion weighers from old testdata

This commit is contained in:
Ilya Kirillov
2020-12-12 14:44:51 +01:00
parent 19fff2b1e7
commit 299f36183c
6 changed files with 574 additions and 3 deletions
@@ -1,3 +1,5 @@
// FIR_COMPARISON
fun shouldCompleteTopLevelCallablesFromIndex() = true
fun foo(statement: String) {
@@ -1,3 +1,5 @@
// FIR_COMPARISON
interface I {
fun takeXxx(): Int = 0
fun takeYyy(): String = ""
@@ -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") {