mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
* `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
26 lines
465 B
Zig
26 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
|