diff options
Diffstat (limited to 'lang/zig/switch-exhaust.zig')
-rw-r--r-- | lang/zig/switch-exhaust.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lang/zig/switch-exhaust.zig b/lang/zig/switch-exhaust.zig new file mode 100644 index 0000000..4777f19 --- /dev/null +++ b/lang/zig/switch-exhaust.zig @@ -0,0 +1,9 @@ +const Color = enum { auto, off, on }; + +test "exhaustive switching" { + const color = Color.off; + switch (color) { + Color.auto => {}, + Color.on => {}, + } +} |