mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
e3424332d3
* `doc/langref` formatting * upgrade `.{ .path = "..." }` to `b.path("...")` * avoid using arguments named `self` * make `Build.Step.Id` usage more consistent * add `Build.pathResolve` * use `pathJoin` and `pathResolve` everywhere * make sure `Build.LazyPath.getPath2` returns an absolute path
27 lines
465 B
Zig
27 lines
465 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
const Number = enum(u8) {
|
|
one,
|
|
two,
|
|
three,
|
|
_,
|
|
};
|
|
|
|
test "switch on non-exhaustive enum" {
|
|
const number = Number.one;
|
|
const result = switch (number) {
|
|
.one => true,
|
|
.two, .three => false,
|
|
_ => false,
|
|
};
|
|
try expect(result);
|
|
const is_one = switch (number) {
|
|
.one => true,
|
|
else => false,
|
|
};
|
|
try expect(is_one);
|
|
}
|
|
|
|
// test
|