mirror of
https://github.com/ziglang/zig.git
synced 2024-11-14 16:13:24 +00:00
23 lines
379 B
Zig
23 lines
379 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
const print = std.debug.print;
|
|
|
|
test "defer unwinding" {
|
|
print("\n", .{});
|
|
|
|
defer {
|
|
print("1 ", .{});
|
|
}
|
|
defer {
|
|
print("2 ", .{});
|
|
}
|
|
if (false) {
|
|
// defers are not run if they are never executed.
|
|
defer {
|
|
print("3 ", .{});
|
|
}
|
|
}
|
|
}
|
|
|
|
// test
|