diff options
| author | Martin Wickham <spexguy070@gmail.com> | 2021-09-30 00:19:21 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-09-30 18:00:13 -0400 |
| commit | c82c3585c8fdf02820747c118c78957e2eb5d072 (patch) | |
| tree | d2b708577d98cd1d4e980435be1a7be48a8fd3ce /lib/std | |
| parent | f87156e33c688effcf00b8fa9c2542391423ee78 (diff) | |
| download | zig-c82c3585c8fdf02820747c118c78957e2eb5d072.tar.gz zig-c82c3585c8fdf02820747c118c78957e2eb5d072.zip | |
Add error message to test runner for bad arguments
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/special/test_runner.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/std/special/test_runner.zig b/lib/std/special/test_runner.zig index b762e7784e..e72204377f 100644 --- a/lib/std/special/test_runner.zig +++ b/lib/std/special/test_runner.zig @@ -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]; } |
