test_coerce_optional_wrapped_error_union.zig (266B) - Raw
1 const std = @import("std"); 2 const expect = std.testing.expect; 3 4 test "coerce to optionals wrapped in error union" { 5 const x: anyerror!?i32 = 1234; 6 const y: anyerror!?i32 = null; 7 8 try expect((try x).? == 1234); 9 try expect((try y) == null); 10 } 11 12 // test