test: when test-filter text-key is contained in filename, all cases ran
Zig Version
0.13.0-dev.73+db890dbae
Steps to Reproduce and Observed Behavior
zig test hello.zig --test-filter hell
// hello.zig
const std = @import("std");
test "hell" {
try std.testing.expect(true);
}
test "world" {
try std.testing.expect(false);
}
here the hello.zig filename contains the text hell
Expected Behavior
run only test case hell
Since https://github.com/ziglang/zig/pull/19079, --test-filter works on fully qualified names, so this is intentional.
I believe the fully qualified name of the hell test in your case would be hello.test.hell, so if you want to specifically run tests named hell, you can filter for test.hell.
@squeek502 Is there (a plan to add) some way to list all found/executed tests?
I'd imagine a zig test --list with sorted output would be useful in trying to figure out why a test was/wasn't run, finding typos etc.
Since #19079,
--test-filterworks on fully qualified names, so this is intentional.I believe the fully qualified name of the
helltest in your case would behello.test.hell, so if you want to specifically run tests namedhell, you can filter fortest.hell.
i see. the filename.test. is an inclusive prefix for all test names --test-filter.
maybe the docs should be updated to make this intentional idea more obviously ;-p
btw, should the directory part of the file path be inclusive too? i mean this case zig test say/hello.zig --test-filter hell