zig/test/behavior/import.zig
Andrew Kelley 17f057c556 stage2: implement @typeName
* stage1: change the `@typeName` of `@TypeOf(undefined)`,
   `@TypeOf(null)`, and `@TypeOf(.foo)` to match stage2.
 * move passing behavior tests to the passing-for-stage2 section.
2021-11-27 00:27:52 -07:00

23 lines
599 B
Zig

const expect = @import("std").testing.expect;
const expectEqual = @import("std").testing.expectEqual;
const a_namespace = @import("import/a_namespace.zig");
test "call fn via namespace lookup" {
try expect(@as(i32, 1234) == a_namespace.foo());
}
test "importing the same thing gives the same import" {
try expect(@import("std") == @import("std"));
}
test "import in non-toplevel scope" {
const S = struct {
usingnamespace @import("import/a_namespace.zig");
};
try expect(@as(i32, 1234) == S.foo());
}
test "import empty file" {
_ = @import("import/empty.zig");
}