Open
Description
Zig Version
0.9.0-dev.1737+c42763f8c
Steps to Reproduce
mkdir repro
cd repro
zig init-exe
mkdir subdir
mkdir other_subdir
touch subdir/solution.zig
touch other_subdir/solution.zig
edit src/Main.zig
to
const std = @import("std");
const solution = @import("./subdir/solution.zig");
pub fn main() anyerror!void {
std.log.info("All your codebase are belong to us.", .{});
solution.solve();
}
test "basic test" {
try std.testing.expect(true);
}
edit src/subdir/solution.zig
to:
const std = @import("std");
const shared = @import("./../other_subdir/shared.zig");
pub fn solve() void {
std.log.info("in solve", .{});
shared.some_func();
}
test "solution test" {
try std.testing.expect(true);
}
edit src/other_subdir/shared.zig
to
const std = @import("std");
pub fn some_func() void {
std.log.info("in some_func", .{});
}
then run
zig test src/Main.src
>> All 1 tests passed.
zig test ./src/subdir/solution.zig
>> <nothing outputs>
then go into ./src/subdir/solution.zig
and change it to
const std = @import("std");
// const shared = @import("./../other_subdir/shared.zig");
pub fn solve() void {
std.log.info("in solve", .{});
// shared.some_func();
}
test "solution test" {
try std.testing.expect(true);
}
and rerun
zig test src/Main.src
>> All 1 tests passed.
zig test ./src/subdir/solution.zig
>> All 1 tests passed.
Expected Behavior
I expect to be able to run zig test somefile/in/subdirs/file.zig
to detect and run the tests in <..>/file.zig
regardless of whether @import
is used
Actual Behavior
zig test somefile/in/subdirs/file.zig
is silently running, and not apparently doing anything once the tests compile.
The tests are detected, because removing the test "solution test" { ... }
block, zig test <..>/solution.zig
correctly tells me that no tests are detected. Any compiler errors are properly detected here.