Minor: added regression tests for downTo.

Adopted tests from patch attached to KT-2586.
This commit is contained in:
Zalim Bashorov
2014-10-21 16:28:13 +04:00
parent fedbe26480
commit b3e34cc2b4
2 changed files with 28 additions and 0 deletions
@@ -53,4 +53,8 @@ public final class RangeTest extends SingleFileTranslationTest {
public void testRangeEquals() throws Exception {
checkFooBoxIsOk();
}
public void testIntDownTo() throws Exception {
checkFooBoxIsOk();
}
}
@@ -0,0 +1,24 @@
package foo
import java.util.ArrayList
fun testDownTo() {
var elems = ArrayList<Int>()
for (i in 4 downTo 0) {
elems.add(i)
}
assertTrue(elems[0] == 4 && elems[1] == 3 && elems[2] == 2 && elems[3] == 1 && elems[4] == 0)
}
fun testDownToDoesNotIterate() {
for (i in 0 downTo 1) {
fail()
}
}
fun box(): String {
testDownTo()
testDownToDoesNotIterate()
return "OK"
}