zig/test/behavior/bugs/3046.zig
Jacob Young 525dcaecba behavior: enable stage2_c tests that are currently passing
Also fix C warnings triggered by these tests.
2022-10-25 05:11:28 -04:00

24 lines
524 B
Zig

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;
some_struct = SomeStruct{
.field = couldFail() catch @as(i32, 0),
};
try expect(some_struct.field == 1);
}