commit 61d7e31078fc54010009494d894e2461b41eeee2 (tree)
parent 8a8f148c8cb1254a3989584c54181218434b56c9
Author: Andrew Kelley <andrew@ziglang.org>
Date: Mon, 13 Mar 2023 12:15:45 -0700
remove bad unit test from std lib
This unit test tested the command line arguments which were passed to
the test runner, which is not really something that unit tests are
supposed to observe.
The proper way to test command line argument parsing is with a
standalone test, where the set of command line arguments being tested
for are also being controlled by the test itself.
Diffstat:
1 file changed, 0 insertions(+), 18 deletions(-)
diff --git a/lib/std/process.zig b/lib/std/process.zig
@@ -828,24 +828,6 @@ pub fn argsWithAllocator(allocator: Allocator) ArgIterator.InitError!ArgIterator
return ArgIterator.initWithAllocator(allocator);
}
-test "args iterator" {
- var ga = std.testing.allocator;
- var it = try argsWithAllocator(ga);
- defer it.deinit(); // no-op unless WASI or Windows
-
- const prog_name = it.next() orelse unreachable;
- const expected_suffix = switch (builtin.os.tag) {
- .wasi => "test.wasm",
- .windows => "test.exe",
- else => "test",
- };
- const given_suffix = std.fs.path.basename(prog_name);
-
- try testing.expect(mem.eql(u8, expected_suffix, given_suffix));
- try testing.expect(it.next() == null);
- try testing.expect(!it.skip());
-}
-
/// Caller must call argsFree on result.
pub fn argsAlloc(allocator: Allocator) ![][:0]u8 {
// TODO refactor to only make 1 allocation.