mirror of
https://github.com/ziglang/zig.git
synced 2025-12-29 01:23:17 +00:00
CLI: fix logic for zig test error message
When using the build system to do unit testing, it lowers to --mod arguments which were incorrectly tripping a "zig test requires a source file argument" error.
This commit is contained in:
parent
b36659c972
commit
4c07d41b52
@ -2522,10 +2522,6 @@ fn buildOutputType(
|
||||
fatal("translate-c expects exactly 1 source file (found {d})", .{create_module.c_source_files.items.len});
|
||||
}
|
||||
|
||||
if (root_src_file == null and arg_mode == .zig_test) {
|
||||
fatal("`zig test` expects a zig source file argument", .{});
|
||||
}
|
||||
|
||||
if (show_builtin and root_src_file == null) {
|
||||
// Without this, there will be no main module created and no zig
|
||||
// compilation unit, and therefore also no builtin.zig contents
|
||||
@ -2616,6 +2612,10 @@ fn buildOutputType(
|
||||
rc_source_files_owner_index = create_module.rc_source_files.items.len;
|
||||
}
|
||||
|
||||
if (!create_module.opts.have_zcu and arg_mode == .zig_test) {
|
||||
fatal("`zig test` expects a zig source file argument", .{});
|
||||
}
|
||||
|
||||
if (c_source_files_owner_index != create_module.c_source_files.items.len) {
|
||||
fatal("C source file '{s}' has no parent module", .{
|
||||
create_module.c_source_files.items[c_source_files_owner_index].src_path,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user