authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-11 19:42:07-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-11 19:42:07-04:00
log761356209bd64ed655be96c0cf11869f2ff5f530
tree7214380aff31f4bd6a1ea22e5849f8808604c8ae
parent1a94dec50e3d8804a1f8191c34afc7e00283f55e
signaturelock-open Commit is signed but in an unrecognized format.

add test cases to cover switching on u0 values

closes #1563

1 files changed, 14 insertions(+), 0 deletions(-)

test/stage1/behavior/switch.zig+14
......@@ -269,3 +269,17 @@ fn testSwitchOnBoolsFalseWithElse(x: bool) bool {
269269 else => false,
270270 };
271271}
272
273test "u0" {
274 var val: u0 = 0;
275 switch (val) {
276 0 => expect(val == 0),
277 }
278}
279
280test "undefined.u0" {
281 var val: u0 = undefined;
282 switch (val) {
283 0 => expect(val == 0),
284 }
285}