Added support for break expressions in while/do while.
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user