1#exe {
2--dep foo -Mroot=main.zig
3-Mfoo=foo.zig
4#}
5
6#write main.zig {
7pub fn main() void {
8 _ = @import("foo");
9 //_ = @import("other.zig");
10}
11#}
12#write foo.zig {
13comptime {
14 _ = @import("other.zig");
15}
16#}
17#write other.zig {
18fn f() void {
19 @compileLog(@src().module);
20}
21comptime {
22 f();
23}
24#}
25#update
26#check errors {
27other.zig:2:5: error: found compile log statement
28
29Compile Log Output:
30@as([:0]const u8, "foo"[0..3])
31#}
32
33#write main.zig {
34pub fn main() void {
35 _ = @import("foo");
36 _ = @import("other.zig");
37}
38#}
39#write foo.zig {
40comptime {
41 //_ = @import("other.zig");
42}
43#}
44#update "change module of other.zig"
45#check errors {
46other.zig:2:5: error: found compile log statement
47
48Compile Log Output:
49@as([:0]const u8, "root"[0..4])
50#}
51
52#write main.zig {
53pub fn main() void {
54 _ = @import("foo");
55 _ = @import("other.zig");
56}
57#}
58#write foo.zig {
59comptime {
60 _ = @import("other.zig");
61}
62#}
63#update "put other.zig in both modules"
64#check errors {
65other.zig:1:1: error: file exists in modules 'root' and 'foo'
66other.zig:1:1: note: files must belong to only one module
67main.zig:3:17: note: file is imported here by the root of module 'root'
68foo.zig:2:17: note: file is imported here by the root of module 'foo'
69#}
70
71#write main.zig {
72pub fn main() void {
73 _ = @import("foo");
74 //_ = @import("other.zig");
75}
76#}
77#write foo.zig {
78comptime {
79 //_ = @import("other.zig");
80}
81#}
82#update "put other.zig in no modules"
83#check stdout