2019-02-09 07:18:47 +08:00
|
|
|
const expect = @import("std").testing.expect;
|
2019-05-19 05:48:38 +08:00
|
|
|
const expectEqual = @import("std").testing.expectEqual;
|
2019-01-30 10:47:26 +08:00
|
|
|
const a_namespace = @import("import/a_namespace.zig");
|
|
|
|
|
|
|
|
test "call fn via namespace lookup" {
|
2021-05-05 02:23:22 +08:00
|
|
|
try expectEqual(@as(i32, 1234), a_namespace.foo());
|
2019-01-30 10:47:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
test "importing the same thing gives the same import" {
|
2021-05-05 02:23:22 +08:00
|
|
|
try expect(@import("std") == @import("std"));
|
2019-01-30 10:47:26 +08:00
|
|
|
}
|
2019-05-19 05:48:38 +08:00
|
|
|
|
|
|
|
test "import in non-toplevel scope" {
|
|
|
|
const S = struct {
|
2019-05-30 06:55:42 +08:00
|
|
|
usingnamespace @import("import/a_namespace.zig");
|
2019-05-19 05:48:38 +08:00
|
|
|
};
|
2021-05-05 02:23:22 +08:00
|
|
|
try expectEqual(@as(i32, 1234), S.foo());
|
2019-05-19 05:48:38 +08:00
|
|
|
}
|
2020-10-27 01:42:23 +08:00
|
|
|
|
|
|
|
test "import empty file" {
|
|
|
|
const empty = @import("import/empty.zig");
|
|
|
|
}
|