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