From 898ef82d65af9a00aadc7ed63e5e1c0bc6c52bde Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Wed, 29 Jan 2020 21:35:08 -0600 Subject: [PATCH] Patch in arena to cleanup leaks --- test/standalone/brace_expansion/main.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/standalone/brace_expansion/main.zig b/test/standalone/brace_expansion/main.zig index c6bfd02e79..e1d2ee6673 100644 --- a/test/standalone/brace_expansion/main.zig +++ b/test/standalone/brace_expansion/main.zig @@ -201,7 +201,10 @@ pub fn main() !void { } test "invalid inputs" { - global_allocator = std.testing.allocator; + var arena = std.heap.ArenaAllocator.init(std.testing.allocator); + defer arena.deinit(); + + global_allocator = &arena.allocator; expectError("}ABC", error.InvalidInput); expectError("{ABC", error.InvalidInput); @@ -222,7 +225,10 @@ fn expectError(test_input: []const u8, expected_err: anyerror) void { } test "valid inputs" { - global_allocator = std.testing.allocator; + var arena = std.heap.ArenaAllocator.init(std.testing.allocator); + defer arena.deinit(); + + global_allocator = &arena.allocator; expectExpansion("{x,y,z}", "x y z"); expectExpansion("{A,B}{x,y}", "Ax Ay Bx By");