Commit 761356209b

Andrew Kelley <andrew@ziglang.org>
2019-03-12 00:42:07
add test cases to cover switching on u0 values
closes #1563
1 parent 1a94dec
Changed files (1)
test
stage1
behavior
test/stage1/behavior/switch.zig
@@ -269,3 +269,17 @@ fn testSwitchOnBoolsFalseWithElse(x: bool) bool {
         else => false,
     };
 }
+
+test "u0" {
+    var val: u0 = 0;
+    switch (val) {
+        0 => expect(val == 0),
+    }
+}
+
+test "undefined.u0" {
+    var val: u0 = undefined;
+    switch (val) {
+        0 => expect(val == 0),
+    }
+}