mirror of
https://github.com/ziglang/zig.git
synced 2026-01-03 20:13:21 +00:00
parent
3b4a6679a6
commit
c9a5a6b83a
@ -31,6 +31,7 @@ comptime {
|
||||
_ = @import("behavior/bugs/2346.zig");
|
||||
_ = @import("behavior/bugs/2578.zig");
|
||||
_ = @import("behavior/bugs/2692.zig");
|
||||
_ = @import("behavior/bugs/3046.zig");
|
||||
_ = @import("behavior/bugs/3112.zig");
|
||||
_ = @import("behavior/bugs/394.zig");
|
||||
_ = @import("behavior/bugs/421.zig");
|
||||
|
||||
19
test/stage1/behavior/bugs/3046.zig
Normal file
19
test/stage1/behavior/bugs/3046.zig
Normal file
@ -0,0 +1,19 @@
|
||||
const std = @import("std");
|
||||
const expect = std.testing.expect;
|
||||
|
||||
const SomeStruct = struct {
|
||||
field: i32,
|
||||
};
|
||||
|
||||
fn couldFail() anyerror!i32 {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var some_struct: SomeStruct = undefined;
|
||||
|
||||
test "fixed" {
|
||||
some_struct = SomeStruct{
|
||||
.field = couldFail() catch |_| i32(0),
|
||||
};
|
||||
expect(some_struct.field == 1);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user