zig/doc/langref/test_unhandled_enumeration_value.zig

16 lines
233 B
Zig

const Color = enum {
auto,
off,
on,
};
test "exhaustive switching" {
const color = Color.off;
switch (color) {
Color.auto => {},
Color.on => {},
}
}
// test_error=unhandled enumeration value