aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/while.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-24 22:45:10 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-24 22:45:10 -0700
commit7f91be9c80f8d79e4a2c6cf0b15197cdd454cef6 (patch)
tree3356aeb0462c236f4e9af621415ad4582ea4f832 /test/behavior/while.zig
parentbcf2eb1a003d076c166d4ce9cba20f6ed9b53887 (diff)
downloadzig-7f91be9c80f8d79e4a2c6cf0b15197cdd454cef6.tar.gz
zig-7f91be9c80f8d79e4a2c6cf0b15197cdd454cef6.zip
AstGen: emit break_inline from inline while loop
Diffstat (limited to 'test/behavior/while.zig')
-rw-r--r--test/behavior/while.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/behavior/while.zig b/test/behavior/while.zig
index 5bbcb153c5..71f1d253e9 100644
--- a/test/behavior/while.zig
+++ b/test/behavior/while.zig
@@ -1,6 +1,7 @@
const std = @import("std");
const builtin = @import("builtin");
const expect = std.testing.expect;
+const assert = std.debug.assert;
test "while loop" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
@@ -326,3 +327,12 @@ test "while error 2 break statements and an else" {
try S.entry(true, false);
comptime try S.entry(true, false);
}
+
+test "continue inline while loop" {
+ comptime var i = 0;
+ inline while (i < 10) : (i += 1) {
+ if (i < 5) continue;
+ break;
+ }
+ comptime assert(i == 5);
+}