Skip to content

Commit 8fef23a

Browse files
committed
add regression test for bug fixed by lazy values
closes #1310
1 parent 35a374e commit 8fef23a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

test/stage1/behavior.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ comptime {
1515
_ = @import("behavior/bugs/1111.zig");
1616
_ = @import("behavior/bugs/1120.zig");
1717
_ = @import("behavior/bugs/1277.zig");
18+
_ = @import("behavior/bugs/1310.zig");
1819
_ = @import("behavior/bugs/1322.zig");
1920
_ = @import("behavior/bugs/1381.zig");
2021
_ = @import("behavior/bugs/1421.zig");

test/stage1/behavior/bugs/1310.zig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const std = @import("std");
2+
const expect = std.testing.expect;
3+
4+
pub const VM = ?[*]const struct_InvocationTable_;
5+
pub const struct_InvocationTable_ = extern struct {
6+
GetVM: ?extern fn (?[*]VM) c_int,
7+
};
8+
9+
pub const struct_VM_ = extern struct {
10+
functions: ?[*]const struct_InvocationTable_,
11+
};
12+
13+
//excised output from stdlib.h etc
14+
15+
pub const InvocationTable_ = struct_InvocationTable_;
16+
pub const VM_ = struct_VM_;
17+
18+
extern fn agent_callback(_vm: [*]VM, options: [*]u8) i32 {
19+
return 11;
20+
}
21+
22+
test "fixed" {
23+
expect(agent_callback(undefined, undefined) == 11);
24+
}

0 commit comments

Comments
 (0)