mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-17 00:21:27 +00:00
Safe Delete: Add test for primary constructor with usages in delegation calls
This commit is contained in:
@@ -481,6 +481,7 @@ fun main(args: Array<String>) {
|
||||
|
||||
testClass(javaClass<AbstractJetSafeDeleteTest>()) {
|
||||
model("safeDelete/deleteClass/kotlinClass", testMethod = "doClassTest")
|
||||
model("safeDelete/deleteClass/kotlinClassWithJava", testMethod = "doClassTestWithJava")
|
||||
model("safeDelete/deleteObject/kotlinObject", testMethod = "doObjectTest")
|
||||
model("safeDelete/deleteFunction/kotlinFunction", testMethod = "doFunctionTest")
|
||||
model("safeDelete/deleteFunction/kotlinFunctionWithJava", testMethod = "doFunctionTestWithJava")
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class J extends B {
|
||||
public J() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
open class <caret>B() {
|
||||
constructor(a: Int): this() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
open class A: B {
|
||||
constructor(a: Int): super() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
class B has 4 usages that are not safe to delete.
|
||||
@@ -54,6 +54,10 @@ public abstract class AbstractJetSafeDeleteTest extends JetLightCodeInsightFixtu
|
||||
doTest(path, JetClass.class, false);
|
||||
}
|
||||
|
||||
public void doClassTestWithJava(@NotNull String path) throws Exception {
|
||||
doTest(path, JetClass.class, true);
|
||||
}
|
||||
|
||||
public void doObjectTest(@NotNull String path) throws Exception {
|
||||
doTest(path, JetObjectDeclaration.class, false);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.regex.Pattern;
|
||||
@SuppressWarnings("all")
|
||||
@InnerTestClasses({
|
||||
JetSafeDeleteTestGenerated.KotlinClass.class,
|
||||
JetSafeDeleteTestGenerated.KotlinClassWithJava.class,
|
||||
JetSafeDeleteTestGenerated.KotlinObject.class,
|
||||
JetSafeDeleteTestGenerated.KotlinFunction.class,
|
||||
JetSafeDeleteTestGenerated.KotlinFunctionWithJava.class,
|
||||
@@ -119,6 +120,21 @@ public class JetSafeDeleteTestGenerated extends AbstractJetSafeDeleteTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/safeDelete/deleteClass/kotlinClassWithJava")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class KotlinClassWithJava extends AbstractJetSafeDeleteTest {
|
||||
public void testAllFilesPresentInKotlinClassWithJava() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/safeDelete/deleteClass/kotlinClassWithJava"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("classWithDelegationCalls.kt")
|
||||
public void testClassWithDelegationCalls() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/safeDelete/deleteClass/kotlinClassWithJava/classWithDelegationCalls.kt");
|
||||
doClassTestWithJava(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/safeDelete/deleteObject/kotlinObject")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user