aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-11-26 15:38:07 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-11-26 15:38:07 -0500
commit4619b5de0609e98c0c98fe352f3bc32f036b6ad4 (patch)
treeb58718b204a63ba21f48d7eeac067baee53e903f /test
parent24b65e41ee241c805e0eff8212ef49c5c39e4b8e (diff)
downloadzig-4619b5de0609e98c0c98fe352f3bc32f036b6ad4.tar.gz
zig-4619b5de0609e98c0c98fe352f3bc32f036b6ad4.zip
IR: support inline switch
Diffstat (limited to 'test')
-rw-r--r--test/self_hosted2.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/self_hosted2.zig b/test/self_hosted2.zig
index d3dfb6811f..0ed6bca373 100644
--- a/test/self_hosted2.zig
+++ b/test/self_hosted2.zig
@@ -49,6 +49,18 @@ fn testSwitchWithAllRanges(x: u32, y: u32) -> u32 {
}
}
+fn testInlineSwitch() {
+ const x = 3 + 4;
+ const result = inline switch (x) {
+ 3 => 10,
+ 4 => 11,
+ 5, 6 => 12,
+ 7, 8 => 13,
+ else => 14,
+ };
+ assert(result + 1 == 14);
+}
+
fn assert(ok: bool) {
if (!ok)
@unreachable();
@@ -60,6 +72,7 @@ fn runAllTests() {
inlinedLoop();
switchWithNumbers();
switchWithAllRanges();
+ testInlineSwitch();
}
export nakedcc fn _start() -> unreachable {