Split test for whens

This commit is contained in:
Valentin Kipyatkov
2016-08-28 11:15:53 +03:00
parent dc1f2d5b5f
commit 1221b6bb67
7 changed files with 41 additions and 27 deletions
@@ -32,25 +32,3 @@ fun y(o: Any) {
val list = o as List<A>
val (x, y) = list[0]
}
fun when1(o: Any) {
when (o) {
is A -> {
val (x, y) = o
}
is String -> TODO()
else -> return
}
}
fun when2(o: Any) {
when (o) {
!is A -> { }
else -> {
val (x, y) = o
}
}
}
@@ -12,6 +12,4 @@ Used plain search in LocalSearchScope:
CLASS:A
FUN:ext1
FUN:ext1
FUN:x
KtWhenEntry "else"
KtWhenEntry "is A"
FUN:x
@@ -10,8 +10,6 @@
[dataClass.2.kt] Value read 26 val (x, y) = o
[dataClass.2.kt] Value read 27 val (x1, y1) = A(1, "", "")
[dataClass.2.kt] Value read 33 val (x, y) = list[0]
[dataClass.2.kt] Value read 39 val (x, y) = o
[dataClass.2.kt] Value read 5 a.n
[dataClass.2.kt] Value read 53 val (x, y) = o
[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,26 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtParameter
// OPTIONS: usages
data class A(val <caret>a: Int, val b: Int)
fun when1(o: Any) {
when (o) {
is A -> {
val (x, y) = o
}
is String -> TODO()
else -> return
}
}
fun when2(o: Any) {
when (o) {
!is A -> { }
else -> {
val (x, y) = o
}
}
}
@@ -0,0 +1,6 @@
Searched inheritors of A
Searched references to A
Used plain search in LocalSearchScope:
CLASS:A
KtWhenEntry "else"
KtWhenEntry "is A"
@@ -0,0 +1,2 @@
Value read 23 val (x, y) = o
Value read 9 val (x, y) = o
@@ -229,6 +229,12 @@ public class FindUsagesTestGenerated extends AbstractFindUsagesTest {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/components/SAM.0.kt");
doTest(fileName);
}
@TestMetadata("when.0.kt")
public void testWhen() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/conventions/components/when.0.kt");
doTest(fileName);
}
}
}