mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 15:42:49 +00:00
4307436b99
And fix test cases to make them pass. This is in preparation for starting to pass behavior tests with self-hosted.
22 lines
443 B
Zig
22 lines
443 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
const Foo = @import("hasdecl/foo.zig");
|
|
|
|
const Bar = struct {
|
|
nope: i32,
|
|
|
|
const hi = 1;
|
|
pub var blah = "xxx";
|
|
};
|
|
|
|
test "@hasDecl" {
|
|
expect(@hasDecl(Foo, "public_thing"));
|
|
expect(!@hasDecl(Foo, "private_thing"));
|
|
expect(!@hasDecl(Foo, "no_thing"));
|
|
|
|
expect(@hasDecl(Bar, "hi"));
|
|
expect(@hasDecl(Bar, "blah"));
|
|
expect(!@hasDecl(Bar, "nope"));
|
|
}
|