mirror of
https://github.com/ziglang/zig.git
synced 2026-01-05 04:53:17 +00:00
16 lines
381 B
Zig
16 lines
381 B
Zig
const expect = @import("std").testing.expect;
|
|
const builtin = @import("builtin");
|
|
|
|
test "@hasField" {
|
|
const enm = enum {
|
|
a,
|
|
b,
|
|
|
|
pub const nope = 1;
|
|
};
|
|
try expect(@hasField(enm, "a") == true);
|
|
try expect(@hasField(enm, "b") == true);
|
|
try expect(@hasField(enm, "non-existant") == false);
|
|
try expect(@hasField(enm, "nope") == false);
|
|
}
|