mirror of
https://github.com/ziglang/zig.git
synced 2024-11-28 08:02:32 +00:00
Patch in arena to cleanup leaks
This commit is contained in:
parent
b077f3ab7d
commit
898ef82d65
@ -201,7 +201,10 @@ pub fn main() !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test "invalid inputs" {
|
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);
|
||||||
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" {
|
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("{x,y,z}", "x y z");
|
||||||
expectExpansion("{A,B}{x,y}", "Ax Ay Bx By");
|
expectExpansion("{A,B}{x,y}", "Ax Ay Bx By");
|
||||||
|
Loading…
Reference in New Issue
Block a user