diff options
| author | Benjamin Feng <benjamin.feng@glassdoor.com> | 2020-01-30 00:14:17 -0600 |
|---|---|---|
| committer | Benjamin Feng <benjamin.feng@glassdoor.com> | 2020-01-30 00:27:44 -0600 |
| commit | 184128fd9e5bfcf9b9a1c1021cf1d8db03147c28 (patch) | |
| tree | 44f6f584c0887273eb87ee42065ee5e03986039b /lib/std/special | |
| parent | 5c8e85f3884c581b17c8df1f19852189fe7c9412 (diff) | |
| download | zig-184128fd9e5bfcf9b9a1c1021cf1d8db03147c28.tar.gz zig-184128fd9e5bfcf9b9a1c1021cf1d8db03147c28.zip | |
Fix testing.allocator wiring
Diffstat (limited to 'lib/std/special')
| -rw-r--r-- | lib/std/special/test_runner.zig | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/std/special/test_runner.zig b/lib/std/special/test_runner.zig index 9a2d68a73d..07c46ee43c 100644 --- a/lib/std/special/test_runner.zig +++ b/lib/std/special/test_runner.zig @@ -14,12 +14,6 @@ pub fn main() anyerror!void { for (test_fn_list) |test_fn, i| { std.testing.base_allocator_instance.reset(); - defer { - std.testing.allocator_instance.validate() catch |err| switch (err) { - error.Leak => std.debug.panic("", .{}), - else => std.debug.panic("error.{}", .{@errorName(err)}), - }; - } var test_node = root_node.start(test_fn.name, null); test_node.activate(); @@ -30,6 +24,10 @@ pub fn main() anyerror!void { if (test_fn.func()) |_| { ok_count += 1; test_node.end(); + std.testing.allocator_instance.validate() catch |err| switch (err) { + error.Leak => std.debug.panic("", .{}), + else => std.debug.panic("error.{}", .{@errorName(err)}), + }; if (progress.terminal == null) std.debug.warn("OK\n", .{}); } else |err| switch (err) { error.SkipZigTest => { |
