mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 09:02:32 +00:00
12 lines
268 B
Zig
12 lines
268 B
Zig
|
const std = @import("std");
|
||
|
|
||
|
test "detect leak" {
|
||
|
var list = std.ArrayList(u21).init(std.testing.allocator);
|
||
|
// missing `defer list.deinit();`
|
||
|
try list.append('☔');
|
||
|
|
||
|
try std.testing.expect(list.items.len == 1);
|
||
|
}
|
||
|
|
||
|
// test_error=1 tests leaked memory
|