mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 04:44:47 +01:00
12 lines
298 B
Zig
12 lines
298 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.expectEqual(1, list.items.len);
|
|
}
|
|
|
|
// test_error=1 tests leaked memory
|