aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJosh Wolfe <thejoshwolfe@gmail.com>2017-11-13 22:56:20 -0700
committerJosh Wolfe <thejoshwolfe@gmail.com>2017-11-13 22:56:20 -0700
commit6ffaf4c2e26e90f7e75d2dd5461addcdb8741c85 (patch)
treee3a72bd4435878583165bc804f0daa91dc7417e3 /test
parent012ce1481e003b25e49934fce17f5e1b4aff218a (diff)
downloadzig-6ffaf4c2e26e90f7e75d2dd5461addcdb8741c85.tar.gz
zig-6ffaf4c2e26e90f7e75d2dd5461addcdb8741c85.zip
parsec supports do loop
Diffstat (limited to 'test')
-rw-r--r--test/parsec.zig27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/parsec.zig b/test/parsec.zig
index a6f23bd2a9..077dcf832c 100644
--- a/test/parsec.zig
+++ b/test/parsec.zig
@@ -804,6 +804,33 @@ pub fn addCases(cases: &tests.ParseCContext) {
\\ };
\\}
);
+
+ cases.addC("do loop",
+ \\void foo(void) {
+ \\ int a = 2;
+ \\ do {
+ \\ a--;
+ \\ } while (a != 0);
+ \\
+ \\ int b = 2;
+ \\ do
+ \\ b--;
+ \\ while (b != 0);
+ \\}
+ ,
+ \\export fn foo() {
+ \\ var a: c_int = 2;
+ \\ while (true) {
+ \\ a -= 1;
+ \\ if (!(a != 0)) break;
+ \\ };
+ \\ var b: c_int = 2;
+ \\ while (true) {
+ \\ b -= 1;
+ \\ if (!(b != 0)) break;
+ \\ };
+ \\}
+ );
}