zig/test/behavior/hasdecl.zig
Andrew Kelley 4307436b99 move behavior tests from test/stage1/ to test/
And fix test cases to make them pass. This is in preparation for
starting to pass behavior tests with self-hosted.
2021-04-29 15:54:04 -07:00

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"));
}