Split test for 'for'

This commit is contained in:
Valentin Kipyatkov
2016-08-28 11:23:58 +03:00
parent c864fce035
commit f447321e58
8 changed files with 52 additions and 39 deletions
@@ -1,10 +1,22 @@
import pack.A import pack.A
fun test() { fun test(javaClass: JavaClass, javaClass2: JavaClass2) {
for ((x, y, z) in arrayOf<A>()) { val a = A(1, "2", Any())
} a.n
a.component1()
for (a in listOf<A>()) { val (x, y, z) = a
val (x, y) = a val (x1, y1, z1) = f()
} val (x2, y2, z2) = g()
val (x3, y3, z3) = h()
val (x4, y4, z4) = listOfA()[0]
val (x5, y5, z5) = javaClass.getA()[0]
} }
fun f(): A = TODO()
fun g() = A()
fun h() = g()
fun listOfA() = listOf<A>(A(1, "", ""))
@@ -1,22 +0,0 @@
import pack.A
fun test(javaClass: JavaClass, javaClass2: JavaClass2) {
val a = A(1, "2", Any())
a.n
a.component1()
val (x, y, z) = a
val (x1, y1, z1) = f()
val (x2, y2, z2) = g()
val (x3, y3, z3) = h()
val (x4, y4, z4) = listOfA()[0]
val (x5, y5, z5) = javaClass.getA()[0]
}
fun f(): A = TODO()
fun g() = A()
fun h() = g()
fun listOfA() = listOf<A>(A(1, "", ""))
@@ -6,7 +6,6 @@ Searched references to g() in Kotlin files
Searched references to h() in Kotlin files Searched references to h() in Kotlin files
Searched references to listOfA() in Kotlin files Searched references to listOfA() in Kotlin files
Searched references to pack.A Searched references to pack.A
Searched references to parameter a in null in Kotlin files
Used plain search in LocalSearchScope: Used plain search in LocalSearchScope:
CLASS:A CLASS:A
FUN:ext1 FUN:ext1
@@ -1,12 +1,10 @@
[dataClass.0.kt] Value read 14 val (x, y) = getThis() [dataClass.0.kt] Value read 14 val (x, y) = getThis()
[dataClass.0.kt] Value read 22 val (x, y) = get(0) [dataClass.0.kt] Value read 22 val (x, y) = get(0)
[dataClass.1.kt] Value read 4 for ((x, y, z) in arrayOf<A>()) { [dataClass.1.kt] Function call 6 a.component1()
[dataClass.1.kt] Value read 8 val (x, y) = a [dataClass.1.kt] Value read 10 val (x2, y2, z2) = g()
[dataClass.2.kt] Function call 6 a.component1() [dataClass.1.kt] Value read 11 val (x3, y3, z3) = h()
[dataClass.2.kt] Value read 10 val (x2, y2, z2) = g() [dataClass.1.kt] Value read 13 val (x4, y4, z4) = listOfA()[0]
[dataClass.2.kt] Value read 11 val (x3, y3, z3) = h() [dataClass.1.kt] Value read 15 val (x5, y5, z5) = javaClass.getA()[0]
[dataClass.2.kt] Value read 13 val (x4, y4, z4) = listOfA()[0] [dataClass.1.kt] Value read 5 a.n
[dataClass.2.kt] Value read 15 val (x5, y5, z5) = javaClass.getA()[0] [dataClass.1.kt] Value read 8 val (x, y, z) = a
[dataClass.2.kt] Value read 5 a.n [dataClass.1.kt] Value read 9 val (x1, y1, z1) = f()
[dataClass.2.kt] Value read 8 val (x, y, z) = a
[dataClass.2.kt] Value read 9 val (x1, y1, z1) = f()
@@ -0,0 +1,13 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
data class A(val <caret>n: Int, val s: String, val o: Any) {
fun test() {
for ((x, y, z) in arrayOf<A>()) {
}
for (a in listOf<A>()) {
val (x, y) = a
}
}
@@ -0,0 +1,5 @@
Searched inheritors of A
Searched references to A
Searched references to parameter a in null in Kotlin files
Used plain search in LocalSearchScope:
CLASS:A
@@ -0,0 +1,2 @@
Value read 11 val (x, y) = a
Value read 7 for ((x, y, z) in arrayOf<A>()) {
@@ -212,6 +212,12 @@ public class FindUsagesTestGenerated extends AbstractFindUsagesTest {
doTest(fileName); doTest(fileName);
} }
@TestMetadata("for.0.kt")
public void testFor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/components/for.0.kt");
doTest(fileName);
}
@TestMetadata("isAndAs.0.kt") @TestMetadata("isAndAs.0.kt")
public void testIsAndAs() throws Exception { public void testIsAndAs() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/components/isAndAs.0.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/components/isAndAs.0.kt");