zig/test/behavior/usingnamespace.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

23 lines
454 B
Zig

const std = @import("std");
fn Foo(comptime T: type) type {
return struct {
usingnamespace T;
};
}
test "usingnamespace inside a generic struct" {
const std2 = Foo(std);
const testing2 = Foo(std.testing);
std2.testing.expect(true);
testing2.expect(true);
}
usingnamespace struct {
pub const foo = 42;
};
test "usingnamespace does not redeclare an imported variable" {
comptime std.testing.expect(foo == 42);
}