mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 03:24:46 +01:00
12 lines
282 B
Zig
12 lines
282 B
Zig
const std = @import("std");
|
|
const expectEqual = std.testing.expectEqual;
|
|
|
|
test "coerce to optionals wrapped in error union" {
|
|
const x: anyerror!?i32 = 1234;
|
|
const y: anyerror!?i32 = null;
|
|
|
|
try expectEqual(1234, (try x).?);
|
|
try expectEqual(null, (try y));
|
|
}
|
|
|
|
// test
|