#zig test and files in packages

1 messages · Page 1 of 1 (latest)

stray topaz
#

What is the recommended way of running the tests for a single specific file when that file is inside of a package and refers to things above it?

for example:

❯ zig test example_package/file_with_test.zig
example_package/file_with_test.zig:2:23: error: import of file outside package path: '../outer_thing.zig'
const outer = @import("../outer_thing.zig");
                      ^~~~~~~~~~~~~~~~~~~~
referenced by:
    test.check outer value: example_package/file_with_test.zig:10:47
    remaining reference traces hidden; use '-freference-trace' to see all reference traces
old bridge
#

you can use --main-pkg-path to set the root directory that paths are resolved relative to I believe

#

so if you set it to the parent directory, you should be able to get to outer_thing.zig

stray topaz
#

awesome, thanks! that fixes it