mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 08:33:06 +00:00
4307436b99
And fix test cases to make them pass. This is in preparation for starting to pass behavior tests with self-hosted.
23 lines
454 B
Zig
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);
|
|
}
|