master
 1const std = @import("std");
 2
 3const FileOpenError = error{
 4    AccessDenied,
 5    OutOfMemory,
 6    FileNotFound,
 7};
 8
 9const AllocationError = error{
10    OutOfMemory,
11};
12
13test "coerce subset to superset" {
14    const err = foo(AllocationError.OutOfMemory);
15    try std.testing.expect(err == FileOpenError.OutOfMemory);
16}
17
18fn foo(err: AllocationError) FileOpenError {
19    return err;
20}
21
22// test