aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/test_coerce_optional_wrapped_error_union.zig
blob: c41dd0b1d0f69a878ed8e24e9a4fdbb6d17b61eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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