aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/couscous/tests/frontends
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-11-14 14:30:50 +0000
committerMichael Williamson <mike@zwobble.org>2015-11-14 14:30:50 +0000
commit8a7cb643ac9b0e895123c176803af15b75f90cf1 (patch)
tree046f0b48f76734451fb0c8a39236212e6108bf6f /src/test/java/org/zwobble/couscous/tests/frontends
parentf398933835e7fa7a80b0abd7feda6790370804c8 (diff)
Parse while loops
Diffstat (limited to 'src/test/java/org/zwobble/couscous/tests/frontends')
-rw-r--r--src/test/java/org/zwobble/couscous/tests/frontends/java/JavaReaderTests.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaReaderTests.java b/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaReaderTests.java
index 629a815..7782fdc 100644
--- a/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaReaderTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaReaderTests.java
@@ -45,6 +45,7 @@ import static org.zwobble.couscous.ast.StaticMethodCallNode.unboxInt;
import static org.zwobble.couscous.ast.TernaryConditionalNode.ternaryConditional;
import static org.zwobble.couscous.ast.ThisReferenceNode.thisReference;
import static org.zwobble.couscous.ast.VariableReferenceNode.reference;
+import static org.zwobble.couscous.ast.WhileNode.whileLoop;
import static org.zwobble.couscous.tests.util.ExtraFiles.deleteRecursively;
public class JavaReaderTests {
@@ -366,6 +367,15 @@ public class JavaReaderTests {
asList(returns(literal(2)))),
readStatement("if (true) { return 1; } else { return 2; }"));
}
+
+ @Test
+ public void canReadWhileLoops() {
+ assertEquals(
+ whileLoop(
+ literal(true),
+ asList(returns(literal(1)))),
+ readStatement("while (true) { return 1; }"));
+ }
@Test
public void canDeclareConstructor() {