I have a module dag that depends on another module sys. The source code works fine, but when I execute my tests for the dag module I get the following error:
src/dag/node.zig:3:21: error: no module named 'sys' available within module test
const sys = @import("sys");
I figured that I just needed to add sys as an import to the test executable in the same way that I added it as an import to the main executable in my build.zig. Here is the code I tried:
const sys = b.createModule(.{
.root_source_file = .{ .path = "src/sys/sys.zig" },
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("sys", sys);
exe_unit_tests.root_module.addImport("sys", sys); // added this line
However, this did not resolve the error. Is this even possible or am I a bad person for trying to put non-unit tests in a file that uses multiple modules?
Minimal example: https://github.com/mitchelldw01/tmp/tree/main