mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
13 lines
271 B
Zig
13 lines
271 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
test "coercion to error unions" {
|
|
const x: anyerror!i32 = 1234;
|
|
const y: anyerror!i32 = error.Failure;
|
|
|
|
try expect((try x) == 1234);
|
|
try std.testing.expectError(error.Failure, y);
|
|
}
|
|
|
|
// test
|