Make test for replacement, which requires adding import to the package with operator, independent from stdlib.
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
|||||||
|
// "Replace with 'newFun(n + listOf(s))'" "true"
|
||||||
|
|
||||||
|
import declaration.listOf
|
||||||
|
import declaration.newFun
|
||||||
|
import declaration.oldFun
|
||||||
|
import weird.collections.plus
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
<caret>newFun(listOf(2) + listOf(1))
|
||||||
|
}
|
||||||
Vendored
+8
@@ -0,0 +1,8 @@
|
|||||||
|
package declaration
|
||||||
|
|
||||||
|
fun <T> listOf(element: T): List<T> = throw Exception()
|
||||||
|
|
||||||
|
@Deprecated("", ReplaceWith("newFun(n + listOf(s))", "weird.collections.plus"))
|
||||||
|
fun oldFun(n: List<Int>, s: Int) {}
|
||||||
|
|
||||||
|
fun newFun(n: List<Int>) {}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package weird.collections
|
||||||
|
|
||||||
|
operator fun <T> List<T>.plus(other: T): List<T> = throw Exception()
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
// "Replace with 'newFun(n + listOf(s))'" "true"
|
||||||
|
|
||||||
|
import declaration.listOf
|
||||||
|
import declaration.oldFun
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
<caret>oldFun(listOf(2), 1)
|
||||||
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
// "Replace with 'newFun(n + java.math.BigInteger(s))'" "true"
|
|
||||||
|
|
||||||
import java.math.BigInteger
|
|
||||||
|
|
||||||
@Deprecated("", ReplaceWith("newFun(n + java.math.BigInteger(s))", "kotlin.math.plus"))
|
|
||||||
fun oldFun(n: BigInteger, s: String) {}
|
|
||||||
|
|
||||||
fun newFun(n: BigInteger) {}
|
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
<caret>oldFun(BigInteger("2"), "1")
|
|
||||||
}
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
// "Replace with 'newFun(n + java.math.BigInteger(s))'" "true"
|
|
||||||
|
|
||||||
import java.math.BigInteger
|
|
||||||
import kotlin.math.plus
|
|
||||||
|
|
||||||
@Deprecated("", ReplaceWith("newFun(n + java.math.BigInteger(s))", "kotlin.math.plus"))
|
|
||||||
fun oldFun(n: BigInteger, s: String) {}
|
|
||||||
|
|
||||||
fun newFun(n: BigInteger) {}
|
|
||||||
|
|
||||||
fun foo() {
|
|
||||||
<caret>newFun(BigInteger("2") + BigInteger("1"))
|
|
||||||
}
|
|
||||||
@@ -1139,6 +1139,12 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes
|
|||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public static class Imports extends AbstractQuickFixMultiFileTest {
|
public static class Imports extends AbstractQuickFixMultiFileTest {
|
||||||
|
@TestMetadata("addImportForOperator.before.Main.kt")
|
||||||
|
public void testAddImportForOperator() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/deprecatedSymbolUsage/imports/addImportForOperator.before.Main.kt");
|
||||||
|
doTestWithExtraFile(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("addImportFromSamePackage.before.Main.kt")
|
@TestMetadata("addImportFromSamePackage.before.Main.kt")
|
||||||
public void testAddImportFromSamePackage() throws Exception {
|
public void testAddImportFromSamePackage() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/deprecatedSymbolUsage/imports/addImportFromSamePackage.before.Main.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/deprecatedSymbolUsage/imports/addImportFromSamePackage.before.Main.kt");
|
||||||
|
|||||||
@@ -3931,21 +3931,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("idea/testData/quickfix/deprecatedSymbolUsage/imports")
|
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
|
||||||
public static class Imports extends AbstractQuickFixTest {
|
|
||||||
@TestMetadata("addImportRuntime.kt")
|
|
||||||
public void testAddImportRuntime() throws Exception {
|
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/deprecatedSymbolUsage/imports/addImportRuntime.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllFilesPresentInImports() throws Exception {
|
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/deprecatedSymbolUsage/imports"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("idea/testData/quickfix/deprecatedSymbolUsage/keepComments")
|
@TestMetadata("idea/testData/quickfix/deprecatedSymbolUsage/keepComments")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user