mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
13 lines
266 B
Zig
13 lines
266 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
test "coerce to optionals wrapped in error union" {
|
|
const x: anyerror!?i32 = 1234;
|
|
const y: anyerror!?i32 = null;
|
|
|
|
try expect((try x).? == 1234);
|
|
try expect((try y) == null);
|
|
}
|
|
|
|
// test
|