blob: 683ece874ee3e92fff2f4b2cf761a8b19529f3d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
const std = @import("std");
const builtin = @import("builtin");
const expect = std.testing.expect;
const SomeStruct = struct {
field: i32,
};
fn couldFail() anyerror!i32 {
return 1;
}
var some_struct: SomeStruct = undefined;
test "fixed" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
some_struct = SomeStruct{
.field = couldFail() catch @as(i32, 0),
};
try expect(some_struct.field == 1);
}
|