Better testing
This commit is contained in:
@@ -12,4 +12,10 @@ class JavaClass {
|
||||
}
|
||||
|
||||
public void takeA(A a){}
|
||||
|
||||
private A getAPrivate() {
|
||||
return new A(1, "", "");
|
||||
}
|
||||
|
||||
private void takeAPrivate(A a){}
|
||||
}
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
|
||||
// OPTIONS: usages
|
||||
|
||||
data class A(val <caret>n: Int, val s: String)
|
||||
|
||||
data class B(val x: Int, val y: Int)
|
||||
|
||||
fun condition(a: A) = true
|
||||
|
||||
fun x(a: A, b: Boolean, list: List<Int>) {
|
||||
val (x, y) = if (condition(a)) {
|
||||
print(A(1, "").toString())
|
||||
B(1, 2)
|
||||
}
|
||||
else {
|
||||
B(3, 4)
|
||||
}
|
||||
|
||||
val (x1, y1) = if (b) {
|
||||
A(1, "").apply { val (x2, y2) = this }
|
||||
}
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
if (list.any { it == 0 }) {
|
||||
A(1, "")
|
||||
}
|
||||
}
|
||||
|
||||
fun y1(a: A) = condition(a)
|
||||
fun y2(a: A): Boolean = condition(a)
|
||||
fun y3(a: A) {
|
||||
condition(a)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
Checked type of (x1, y1)
|
||||
Checked type of y1()
|
||||
Searched inheritors of A
|
||||
Searched references to A
|
||||
Searched references to parameter a in condition() in Kotlin files
|
||||
Searched references to parameter a in x() in Kotlin files
|
||||
Searched references to parameter a in y1() in Kotlin files
|
||||
Searched references to parameter a in y2() in Kotlin files
|
||||
Searched references to parameter a in y3() in Kotlin files
|
||||
Used plain search in LocalSearchScope:
|
||||
CLASS:A
|
||||
{ val (x2, y2) = this }
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
Value read 19 val (x1, y1) = if (b) {
|
||||
Value read 20 A(1, "").apply { val (x2, y2) = this }
|
||||
@@ -242,6 +242,12 @@ public class FindUsagesTestGenerated extends AbstractFindUsagesTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("mayTypeAffectAncestors.0.kt")
|
||||
public void testMayTypeAffectAncestors() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/components/mayTypeAffectAncestors.0.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberComponentFun.0.kt")
|
||||
public void testMemberComponentFun() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/components/memberComponentFun.0.kt");
|
||||
|
||||
Reference in New Issue
Block a user