Skip to content

Commit

Permalink
Add error message to test runner for bad arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
SpexGuy authored and andrewrk committed Sep 30, 2021
1 parent f87156e commit c82c358
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/std/special/test_runner.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ fn processArgs() void {
const args = std.process.argsAlloc(&args_allocator.allocator) catch {
@panic("Too many bytes passed over the CLI to the test runner");
};
if (args.len != 2) {
const self_name = if (args.len >= 1) args[0] else if (builtin.os.tag == .windows) "test.exe" else "test";
const zig_ext = if (builtin.os.tag == .windows) ".exe" else "";
std.debug.print("Usage: {s} path/to/zig{s}\n", .{ self_name, zig_ext });
@panic("Wrong number of command line arguments");
}
std.testing.zig_exe_path = args[1];
}

Expand Down

0 comments on commit c82c358

Please sign in to comment.