zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 761356209bd64ed655be96c0cf11869f2ff5f530 (tree)
parent 1a94dec50e3d8804a1f8191c34afc7e00283f55e
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Mon, 11 Mar 2019 19:42:07 -0400

add test cases to cover switching on u0 values

closes #1563

Diffstat:
Mtest/stage1/behavior/switch.zig | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/test/stage1/behavior/switch.zig b/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), + } +}