| ... | @@ -201,7 +201,10 @@ pub fn main() !void { | ... | @@ -201,7 +201,10 @@ pub fn main() !void { |
| 201 | } | 201 | } |
| 202 | | 202 | |
| 203 | test "invalid inputs" { | 203 | test "invalid inputs" { |
| 204 | global_allocator = std.testing.allocator; | 204 | var arena = std.heap.ArenaAllocator.init(std.testing.allocator); |
| | 205 | defer arena.deinit(); |
| | 206 | |
| | 207 | global_allocator = &arena.allocator; |
| 205 | | 208 | |
| 206 | expectError("}ABC", error.InvalidInput); | 209 | expectError("}ABC", error.InvalidInput); |
| 207 | expectError("{ABC", error.InvalidInput); | 210 | expectError("{ABC", error.InvalidInput); |
| ... | @@ -222,7 +225,10 @@ fn expectError(test_input: []const u8, expected_err: anyerror) void { | ... | @@ -222,7 +225,10 @@ fn expectError(test_input: []const u8, expected_err: anyerror) void { |
| 222 | } | 225 | } |
| 223 | | 226 | |
| 224 | test "valid inputs" { | 227 | test "valid inputs" { |
| 225 | global_allocator = std.testing.allocator; | 228 | var arena = std.heap.ArenaAllocator.init(std.testing.allocator); |
| | 229 | defer arena.deinit(); |
| | 230 | |
| | 231 | global_allocator = &arena.allocator; |
| 226 | | 232 | |
| 227 | expectExpansion("{x,y,z}", "x y z"); | 233 | expectExpansion("{x,y,z}", "x y z"); |
| 228 | expectExpansion("{A,B}{x,y}", "Ax Ay Bx By"); | 234 | expectExpansion("{A,B}{x,y}", "Ax Ay Bx By"); |