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.
This commit is contained in:
Andrew Kelley 2023-03-13 12:15:45 -07:00
parent 8a8f148c8c
commit 61d7e31078

View File

@ -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.