Added support for break expressions in while/do while.

This commit is contained in:
Pavel Talanov
2011-11-18 13:19:23 +04:00
parent 37ea3c75ca
commit 16c6e8bee5
3 changed files with 36 additions and 0 deletions
@@ -32,4 +32,14 @@ public final class WhileTest extends AbstractExpressionTest {
public void whileDoesntExecuteEvenOnceIfConditionIsFalse() throws Exception {
testFooBoxIsTrue("while2.kt");
}
@Test
public void breakWhile() throws Exception {
testFooBoxIsTrue("breakWhile.kt");
}
@Test
public void breakDoWhile() throws Exception {
testFooBoxIsTrue("breakDoWhile.kt");
}
}
@@ -0,0 +1,13 @@
namespace foo
fun box() : Boolean {
var i = 0
do {
if (i == 3) {
break;
}
++i;
} while ( i < 100)
return i == 3
}
@@ -0,0 +1,13 @@
namespace foo
fun box() : Boolean {
var i = 0
while ( i < 100) {
if (i == 3) {
break;
}
++i;
}
return i == 3
}