Use defer/panic to better account for test failure

This commit is contained in:
Benjamin Feng 2020-01-29 17:38:52 -06:00
parent 0c137934cb
commit 70ad84c820

View File

@ -14,6 +14,11 @@ pub fn main() anyerror!void {
for (test_fn_list) |test_fn, i| {
std.testing.allocator_instance.reset();
defer {
std.testing.leak_count_allocator_instance.validate() catch |err| {
@panic(@errorName(err));
};
}
var test_node = root_node.start(test_fn.name, null);
test_node.activate();
@ -37,8 +42,6 @@ pub fn main() anyerror!void {
return err;
},
}
try std.testing.leak_count_allocator_instance.validate();
}
root_node.end();
if (ok_count == test_fn_list.len) {