| ... | @@ -828,24 +828,6 @@ pub fn argsWithAllocator(allocator: Allocator) ArgIterator.InitError!ArgIterator | ... | @@ -828,24 +828,6 @@ pub fn argsWithAllocator(allocator: Allocator) ArgIterator.InitError!ArgIterator |
| 828 | return ArgIterator.initWithAllocator(allocator); | 828 | return ArgIterator.initWithAllocator(allocator); |
| 829 | } | 829 | } |
| 830 | | 830 | |
| 831 | test "args iterator" { | | |
| 832 | var ga = std.testing.allocator; | | |
| 833 | var it = try argsWithAllocator(ga); | | |
| 834 | defer it.deinit(); // no-op unless WASI or Windows | | |
| 835 | | | |
| 836 | const prog_name = it.next() orelse unreachable; | | |
| 837 | const expected_suffix = switch (builtin.os.tag) { | | |
| 838 | .wasi => "test.wasm", | | |
| 839 | .windows => "test.exe", | | |
| 840 | else => "test", | | |
| 841 | }; | | |
| 842 | const given_suffix = std.fs.path.basename(prog_name); | | |
| 843 | | | |
| 844 | try testing.expect(mem.eql(u8, expected_suffix, given_suffix)); | | |
| 845 | try testing.expect(it.next() == null); | | |
| 846 | try testing.expect(!it.skip()); | | |
| 847 | } | | |
| 848 | | | |
| 849 | /// Caller must call argsFree on result. | 831 | /// Caller must call argsFree on result. |
| 850 | pub fn argsAlloc(allocator: Allocator) ![][:0]u8 { | 832 | pub fn argsAlloc(allocator: Allocator) ![][:0]u8 { |
| 851 | // TODO refactor to only make 1 allocation. | 833 | // TODO refactor to only make 1 allocation. |