Add Safe Delete tests for extension functions and properties

This commit is contained in:
Alexey Sedunov
2014-01-23 14:56:28 +04:00
parent 572e09e9ea
commit 83c9c49125
31 changed files with 273 additions and 0 deletions
@@ -0,0 +1,11 @@
package test
import test.foo
class B {
}
fun B.<caret>foo() {
}
@@ -0,0 +1,5 @@
package test
class B {
}
@@ -0,0 +1,11 @@
package test
import test.foo
class B {
val ref = ::foo
}
fun B.<caret>foo() {
}
@@ -0,0 +1 @@
function test.foo has 1 usage that is not safe to delete.
@@ -0,0 +1,7 @@
fun foo() {
fun String.<caret>bar() {
}
"".bar()
}
@@ -0,0 +1 @@
function foo.bar has 1 usage that is not safe to delete.
@@ -0,0 +1,7 @@
fun foo() {
fun String.<caret>bar() {
}
println()
}
@@ -0,0 +1,4 @@
fun foo() {
println()
}
@@ -0,0 +1,7 @@
package test;
class A {
void fun bar() {
TestPackage.foo("");
}
}
@@ -0,0 +1,5 @@
package test
fun String.<caret>foo() {
}
@@ -0,0 +1 @@
function test.foo has 1 usage that is not safe to delete.
@@ -0,0 +1,9 @@
package test
import test.foo
val B.<caret>foo = "foo"
class B {
}
@@ -0,0 +1,5 @@
package test
class B {
}
@@ -0,0 +1,9 @@
package test
import test.foo
val String.<caret>foo = "foo"
class B {
val ref = "".foo
}
@@ -0,0 +1 @@
property test.foo has 1 usage that is not safe to delete.
@@ -0,0 +1,7 @@
package test;
class A {
void bar() {
TestPackage.getFoo("");
}
}
@@ -0,0 +1,5 @@
package test
import test.foo
val String.<caret>foo = "foo"
@@ -0,0 +1 @@
property test.foo has 1 usage that is not safe to delete.
@@ -0,0 +1,13 @@
class A {
}
fun A.foo(<caret>a: Int, b: String, c: Any) {
}
class B {
fun bar(a: A) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,13 @@
class A {
}
fun A.foo(b: String, c: Any) {
}
class B {
fun bar(a: A) {
a.foo("1", "!")
}
}
@@ -0,0 +1,13 @@
class A {
}
fun A.foo(a: Int, <caret>b: String, c: Any) {
}
class B {
fun bar(a: A) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,13 @@
class A {
}
fun A.foo(a: Int, c: Any) {
}
class B {
fun bar(a: A) {
a.foo(1, "!")
}
}
@@ -0,0 +1,7 @@
package test;
class B {
void bar(A a) {
TestPackage.foo(a, 1, "1", "!");
}
}
@@ -0,0 +1,7 @@
package test;
class B {
void bar(A a) {
TestPackage.foo(a, "1", "!");
}
}
@@ -0,0 +1,9 @@
package test
class A {
}
fun A.foo(<caret>a: Int, b: String, c: Any) {
}
@@ -0,0 +1,9 @@
package test
class A {
}
fun A.foo(b: String, c: Any) {
}
@@ -0,0 +1,7 @@
package test;
class B {
void bar(A a) {
TestPackage.foo(a, 1, "1", "!");
}
}
@@ -0,0 +1,7 @@
package test;
class B {
void bar(A a) {
TestPackage.foo(a, 1, "!");
}
}
@@ -0,0 +1,9 @@
package test
class A {
}
fun A.foo(a: Int, <caret>b: String, c: Any) {
}
@@ -0,0 +1,9 @@
package test
class A {
}
fun A.foo(a: Int, c: Any) {
}
@@ -164,6 +164,16 @@ public class JetSafeDeleteTestGenerated extends AbstractJetSafeDeleteTest {
doFunctionTest("idea/testData/safeDelete/deleteFunction/kotlinFunction/fun2.kt");
}
@TestMetadata("funExt1.kt")
public void testFunExt1() throws Exception {
doFunctionTest("idea/testData/safeDelete/deleteFunction/kotlinFunction/funExt1.kt");
}
@TestMetadata("funExt2.kt")
public void testFunExt2() throws Exception {
doFunctionTest("idea/testData/safeDelete/deleteFunction/kotlinFunction/funExt2.kt");
}
@TestMetadata("implement1.kt")
public void testImplement1() throws Exception {
doFunctionTest("idea/testData/safeDelete/deleteFunction/kotlinFunction/implement1.kt");
@@ -184,6 +194,16 @@ public class JetSafeDeleteTestGenerated extends AbstractJetSafeDeleteTest {
doFunctionTest("idea/testData/safeDelete/deleteFunction/kotlinFunction/localFun2.kt");
}
@TestMetadata("localFunExt1.kt")
public void testLocalFunExt1() throws Exception {
doFunctionTest("idea/testData/safeDelete/deleteFunction/kotlinFunction/localFunExt1.kt");
}
@TestMetadata("localFunExt2.kt")
public void testLocalFunExt2() throws Exception {
doFunctionTest("idea/testData/safeDelete/deleteFunction/kotlinFunction/localFunExt2.kt");
}
@TestMetadata("noUsages.kt")
public void testNoUsages() throws Exception {
doFunctionTest("idea/testData/safeDelete/deleteFunction/kotlinFunction/noUsages.kt");
@@ -227,6 +247,11 @@ public class JetSafeDeleteTestGenerated extends AbstractJetSafeDeleteTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/safeDelete/deleteFunction/kotlinFunctionWithJava"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("funExt.kt")
public void testFunExt() throws Exception {
doFunctionTestWithJava("idea/testData/safeDelete/deleteFunction/kotlinFunctionWithJava/funExt.kt");
}
@TestMetadata("implement1.kt")
public void testImplement1() throws Exception {
doFunctionTestWithJava("idea/testData/safeDelete/deleteFunction/kotlinFunctionWithJava/implement1.kt");
@@ -398,6 +423,16 @@ public class JetSafeDeleteTestGenerated extends AbstractJetSafeDeleteTest {
doPropertyTest("idea/testData/safeDelete/deleteProperty/kotlinProperty/property2.kt");
}
@TestMetadata("propertyExt1.kt")
public void testPropertyExt1() throws Exception {
doPropertyTest("idea/testData/safeDelete/deleteProperty/kotlinProperty/propertyExt1.kt");
}
@TestMetadata("propertyExt2.kt")
public void testPropertyExt2() throws Exception {
doPropertyTest("idea/testData/safeDelete/deleteProperty/kotlinProperty/propertyExt2.kt");
}
}
@TestMetadata("idea/testData/safeDelete/deleteProperty/kotlinPropertyWithJava")
@@ -456,6 +491,11 @@ public class JetSafeDeleteTestGenerated extends AbstractJetSafeDeleteTest {
doPropertyTestWithJava("idea/testData/safeDelete/deleteProperty/kotlinPropertyWithJava/overrideAndImplement2.kt");
}
@TestMetadata("propertyExt.kt")
public void testPropertyExt() throws Exception {
doPropertyTestWithJava("idea/testData/safeDelete/deleteProperty/kotlinPropertyWithJava/propertyExt.kt");
}
}
@TestMetadata("idea/testData/safeDelete/deleteProperty/javaPropertyWithKotlin")
@@ -773,6 +813,16 @@ public class JetSafeDeleteTestGenerated extends AbstractJetSafeDeleteTest {
doValueParameterTest("idea/testData/safeDelete/deleteValueParameter/kotlinValueParameter/safeUsages3.kt");
}
@TestMetadata("safeUsagesExt1.kt")
public void testSafeUsagesExt1() throws Exception {
doValueParameterTest("idea/testData/safeDelete/deleteValueParameter/kotlinValueParameter/safeUsagesExt1.kt");
}
@TestMetadata("safeUsagesExt2.kt")
public void testSafeUsagesExt2() throws Exception {
doValueParameterTest("idea/testData/safeDelete/deleteValueParameter/kotlinValueParameter/safeUsagesExt2.kt");
}
}
@TestMetadata("idea/testData/safeDelete/deleteValueParameter/kotlinValueParameterWithJava")
@@ -886,6 +936,16 @@ public class JetSafeDeleteTestGenerated extends AbstractJetSafeDeleteTest {
doValueParameterTestWithJava("idea/testData/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/safeUsages3.kt");
}
@TestMetadata("safeUsagesExt1.kt")
public void testSafeUsagesExt1() throws Exception {
doValueParameterTestWithJava("idea/testData/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/safeUsagesExt1.kt");
}
@TestMetadata("safeUsagesExt2.kt")
public void testSafeUsagesExt2() throws Exception {
doValueParameterTestWithJava("idea/testData/safeDelete/deleteValueParameter/kotlinValueParameterWithJava/safeUsagesExt2.kt");
}
}
public static Test suite() {