[IDE-NI-MIGRATE] Migrate completion tests for new inference

This commit is contained in:
Mikhail Zarechenskiy
2019-05-06 04:07:10 +03:00
parent d4d1648e1d
commit c03dfd1522
12 changed files with 27 additions and 0 deletions
@@ -1,3 +1,5 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
fun String.forString(){}
fun Any.forAny(){}
@@ -1,3 +1,5 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
interface A {
fun foo(): Any
fun bar()
@@ -1,3 +1,5 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
val v: Boolean = run {
return<caret> true
}
@@ -1,3 +1,5 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
val v: Boolean = run {
return@run <caret>true
}
@@ -1,3 +1,5 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
fun foo() {
takeHandler1 {
takeHandler2({ ret<caret> })
@@ -1,3 +1,5 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
fun foo() {
takeHandler1 {
takeHandler2({ return@takeHandler2 <caret> })
@@ -1,3 +1,5 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
fun foo() {
takeHandler1 {
takeHandler2({ -> ret<caret> })
@@ -1,3 +1,5 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
fun foo() {
takeHandler1 {
takeHandler2({ -> return@takeHandler2 <caret> })
@@ -1,3 +1,5 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
fun foo(p: Int) {
"abc".fold(1) { <caret> }
}
@@ -1,3 +1,5 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
fun <R> String.fold(initial: R, operation: (acc: R, Char) -> R): R = TODO()
fun foo(p: Int) {
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.idea.completion.test.ExpectedCompletionUtils
import org.jetbrains.kotlin.idea.completion.test.configureWithExtraFile
import org.jetbrains.kotlin.idea.core.formatter.KotlinCodeStyleSettings
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.idea.test.configureCompilerOptions
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.utils.addToStdlib.indexOfOrNull
import java.io.File
@@ -32,6 +33,9 @@ abstract class AbstractCompletionHandlerTest(private val defaultCompletionType:
try {
val fileText = FileUtil.loadFile(File(testPath))
assertTrue("\"<caret>\" is missing in file \"$testPath\"", fileText.contains("<caret>"));
configureCompilerOptions(fileText, project, module)
val invocationCount = InTextDirectivesUtils.getPrefixedInt(fileText, INVOCATION_COUNT_PREFIX) ?: 1
val lookupString = InTextDirectivesUtils.findStringWithPrefixes(fileText, LOOKUP_STRING_PREFIX)
val itemText = InTextDirectivesUtils.findStringWithPrefixes(fileText, ELEMENT_TEXT_PREFIX)
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.idea.completion.test.RELATIVE_COMPLETION_TEST_DATA_B
import org.jetbrains.kotlin.idea.completion.test.configureWithExtraFile
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.idea.test.configureCompilerOptions
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.junit.Assert
@@ -23,6 +24,8 @@ abstract class AbstractCompletionWeigherTest(val completionType: CompletionType,
val text = myFixture.editor.document.text
configureCompilerOptions(text, project, module)
val items = InTextDirectivesUtils.findArrayWithPrefixes(text, "// ORDER:")
Assert.assertTrue("""Some items should be defined with "// ORDER:" directive""", !items.isEmpty())