Added tests

This commit is contained in:
Valentin Kipyatkov
2016-08-12 19:12:04 +03:00
parent f5530c8bf0
commit bfed954e85
3 changed files with 34 additions and 0 deletions
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
fun foo(list: List<String>): Int? {
var index = 0
<caret>for (s in list) {
val x = s.length * index++
index++
if (x > 0) return x
}
return null
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
fun foo(list: List<String>): Int {
var index = 0
<caret>for (s in list) {
val x = s.length * index++
print(x)
print(s)
}
return index
}
@@ -11591,12 +11591,24 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
doTest(fileName);
}
@TestMetadata("indexIncrementTwice.kt")
public void testIndexIncrementTwice() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/useWithIndex/indexIncrementTwice.kt");
doTest(fileName);
}
@TestMetadata("indexPlusPlusInsideExpression.kt")
public void testIndexPlusPlusInsideExpression() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/useWithIndex/indexPlusPlusInsideExpression.kt");
doTest(fileName);
}
@TestMetadata("indexUsedAfterLoop.kt")
public void testIndexUsedAfterLoop() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/useWithIndex/indexUsedAfterLoop.kt");
doTest(fileName);
}
@TestMetadata("prefixPlusPlusInsideExpression.kt")
public void testPrefixPlusPlusInsideExpression() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/useWithIndex/prefixPlusPlusInsideExpression.kt");