TEST: tests for "break" and "continue" added

This commit is contained in:
Konstantin Anisimov
2016-12-01 17:45:47 +03:00
committed by KonstantinAnisimov
parent 3cee19d28e
commit 03e94c6877
2 changed files with 36 additions and 0 deletions
+5
View File
@@ -610,6 +610,11 @@ task unreachable1(type: RunKonanTest) {
source = "codegen/controlflow/unreachable1.kt"
}
task break_continue(type: RunKonanTest) {
goldValue = "while 2\nwhile 4\nwhile 6\nwhile 2\nwhile 4\nwhile 6\nwhile 1\nwhile 3\nwhile 5\n"
source = "codegen/controlflow/break.kt"
}
task range0(type: RunKonanTest) {
goldValue = "123\nabcd\n"
source = "runtime/collections/range0.kt"
@@ -0,0 +1,31 @@
fun foo1() {
var i = 0
while (true) {
if ((i++ % 2) == 0) continue
println("while " + i.toString())
if (i > 4) break
}
}
fun foo2() {
var i = 0
do {
if ((i++ % 2) == 0) continue
println("while " + i.toString())
if (i > 4) break
} while (true)
}
fun foo3() {
for (i in 1..6) {
if ((i % 2) == 0) continue
println("while " + i.toString())
if (i > 4) break
}
}
fun main(args: Array<String>) {
foo1()
foo2()
foo3()
}