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