Your module and test setup looks correct for zig build test
. It must be a reference problem.
There is a way to specify modules in the zig test
command line using the --dep
and -M
flags.
But it is better to use the builder to produce this command line using zig build test
.
Inside your src/main.zig
you must reference all declarations so that the zig compiler includes them in the test compilation.
You can reference all the declarations in a module using std.testing.refAllDecls or std.testing.refAllDeclsRecursive
test {
std.testing.refAllDecls(@This());
}
see: 4) Run your test suite exposed with std.testing.refAllDecls
Run your tests using: zig build test --summary all
or new
--summary [mode] Control the printing of the build summary
all Print the build summary in its entirety
new Omit cached steps
failures (Default) Only print failed steps
none Do not print the build summary