mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
13 lines
295 B
Zig
13 lines
295 B
Zig
const std = @import("std");
|
|
|
|
test "detect leak" {
|
|
const gpa = std.testing.allocator;
|
|
var list: std.ArrayList(u21) = .empty;
|
|
// missing `defer list.deinit(gpa);`
|
|
try list.append(gpa, '☔');
|
|
|
|
try std.testing.expect(list.items.len == 1);
|
|
}
|
|
|
|
// test_error=1 tests leaked memory
|