aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/import.zig
blob: c36aea7d2a9526c4070bd8b7e58a4c1ba4841d97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = 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");
}