Add tests with multiple conditions types in 'when'
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
fun test(n: Int): String {
|
||||
return <caret>if (n !is Int) "???"
|
||||
else if (n in 0..10) "small"
|
||||
else if (n in 10..100) "average"
|
||||
else if (n in 100..1000) "big"
|
||||
else if (n == 1000000) "million"
|
||||
else if (n !in -100..-10) "good"
|
||||
else if (n is Int) "unknown"
|
||||
else "unknown"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun test(n: Int): String {
|
||||
return <caret>when {
|
||||
n !is Int -> "???"
|
||||
n in 0..10 -> "small"
|
||||
n in 10..100 -> "average"
|
||||
n in 100..1000 -> "big"
|
||||
n == 1000000 -> "million"
|
||||
n !in -100..-10 -> "good"
|
||||
n is Int -> "unknown"
|
||||
else -> "unknown"
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun test(n: Int): String {
|
||||
return <caret>when (n) {
|
||||
!is Int -> "???"
|
||||
in 0..10 -> "small"
|
||||
in 10..100 -> "average"
|
||||
in 100..1000 -> "big"
|
||||
1000000 -> "million"
|
||||
!in -100..-10 -> "good"
|
||||
is Int -> "unknown"
|
||||
else -> "unknown"
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun test(n: Int): String {
|
||||
return <caret>if (n !is Int) "???"
|
||||
else if (n in 0..10) "small"
|
||||
else if (n in 10..100) "average"
|
||||
else if (n in 100..1000) "big"
|
||||
else if (n == 1000000) "million"
|
||||
else if (n !in -100..-10) "good"
|
||||
else if (n is Int) "unknown"
|
||||
else "unknown"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun test(n: Int): String {
|
||||
return <caret>when (n) {
|
||||
!is Int -> "???"
|
||||
in 0..10 -> "small"
|
||||
in 10..100 -> "average"
|
||||
in 100..1000 -> "big"
|
||||
1000000 -> "million"
|
||||
!in -100..-10 -> "good"
|
||||
is Int -> "unknown"
|
||||
else -> "unknown"
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun test(n: Int): String {
|
||||
return <caret>when {
|
||||
n !is Int -> "???"
|
||||
n in 0..10 -> "small"
|
||||
n in 10..100 -> "average"
|
||||
n in 100..1000 -> "big"
|
||||
n == 1000000 -> "million"
|
||||
n !in -100..-10 -> "good"
|
||||
n is Int -> "unknown"
|
||||
else -> "unknown"
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun test(n: Int): String {
|
||||
return <caret>when {
|
||||
n !is Int -> "???"
|
||||
n in 0..10 -> "small"
|
||||
n in 10..100 -> "average"
|
||||
n in 100..1000 -> "big"
|
||||
n == 1000000 -> "million"
|
||||
n !in -100..-10 -> "good"
|
||||
n is Int -> "unknown"
|
||||
else -> "unknown"
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun test(n: Int): String {
|
||||
return <caret>when (n) {
|
||||
!is Int -> "???"
|
||||
in 0..10 -> "small"
|
||||
in 10..100 -> "average"
|
||||
in 100..1000 -> "big"
|
||||
1000000 -> "million"
|
||||
!in -100..-10 -> "good"
|
||||
is Int -> "unknown"
|
||||
else -> "unknown"
|
||||
}
|
||||
}
|
||||
+21
-1
@@ -252,7 +252,7 @@ public class CodeTransformationsTestGenerated extends AbstractCodeTransformation
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/unfolding/returnToIf")
|
||||
public static class ReturnToIf extends AbstractCodeTransformationTest {
|
||||
public void testAllFilesPresentInReturnToIf() throws Exception {
|
||||
@@ -345,6 +345,11 @@ public class CodeTransformationsTestGenerated extends AbstractCodeTransformation
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/ifWithRangeTestsAndUnparenthesizedMultiConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithMultipleConditionTypes.kt")
|
||||
public void testWhenWithMultipleConditionTypes() throws Exception {
|
||||
doTestIfToWhen("idea/testData/codeInsight/codeTransformations/branched/ifWhen/ifToWhen/whenWithMultipleConditionTypes.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf")
|
||||
@@ -363,6 +368,11 @@ public class CodeTransformationsTestGenerated extends AbstractCodeTransformation
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithMultiConditions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithMultipleConditionTypes.kt")
|
||||
public void testWhenWithMultipleConditionTypes() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithMultipleConditionTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNegativePatterns.kt")
|
||||
public void testWhenWithNegativePatterns() throws Exception {
|
||||
doTestWhenToIf("idea/testData/codeInsight/codeTransformations/branched/ifWhen/whenToIf/whenWithNegativePatterns.kt");
|
||||
@@ -429,6 +439,11 @@ public class CodeTransformationsTestGenerated extends AbstractCodeTransformation
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithEqualityTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithMultipleConditionTypes.kt")
|
||||
public void testWhenWithMultipleConditionTypes() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithMultipleConditionTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNegativePatterns.kt")
|
||||
public void testWhenWithNegativePatterns() throws Exception {
|
||||
doTestIntroduceWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/introduceSubject/whenWithNegativePatterns.kt");
|
||||
@@ -482,6 +497,11 @@ public class CodeTransformationsTestGenerated extends AbstractCodeTransformation
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithEqualityTests.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithMultipleConditionTypes.kt")
|
||||
public void testWhenWithMultipleConditionTypes() throws Exception {
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithMultipleConditionTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenWithNegativePatterns.kt")
|
||||
public void testWhenWithNegativePatterns() throws Exception {
|
||||
doTestEliminateWhenSubject("idea/testData/codeInsight/codeTransformations/branched/when/eliminateSubject/whenWithNegativePatterns.kt");
|
||||
|
||||
Reference in New Issue
Block a user