| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const debug = std.debug; | 2 | const debug = std.debug; |
| 3 | const expect = std.testing.expect; | 3 | const testing = std.testing; |
| | 4 | const expect = testing.expect; |
| 4 | | 5 | |
| 5 | var argv: [*]const [*]const u8 = undefined; | 6 | var argv: [*]const [*]const u8 = undefined; |
| 6 | | 7 | |
| ... | @@ -23,6 +24,7 @@ fn foo(args: [][]const u8) void { | ... | @@ -23,6 +24,7 @@ fn foo(args: [][]const u8) void { |
| 23 | | 24 | |
| 24 | fn bar(argc: usize) void { | 25 | fn bar(argc: usize) void { |
| 25 | const args = testing.leak_count_allocator.alloc([]const u8, argc) catch unreachable; | 26 | const args = testing.leak_count_allocator.alloc([]const u8, argc) catch unreachable; |
| | 27 | defer testing.leak_count_allocator.free(args); |
| 26 | for (args) |_, i| { | 28 | for (args) |_, i| { |
| 27 | const ptr = argv[i]; | 29 | const ptr = argv[i]; |
| 28 | args[i] = ptr[0..strlen(ptr)]; | 30 | args[i] = ptr[0..strlen(ptr)]; |