add regression test for bug fixed by lazy values

closes #1310
This commit is contained in:
Andrew Kelley 2019-08-27 13:36:42 -04:00
parent 35a374efe0
commit 8fef23a525
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 25 additions and 0 deletions

View File

@ -15,6 +15,7 @@ comptime {
_ = @import("behavior/bugs/1111.zig");
_ = @import("behavior/bugs/1120.zig");
_ = @import("behavior/bugs/1277.zig");
_ = @import("behavior/bugs/1310.zig");
_ = @import("behavior/bugs/1322.zig");
_ = @import("behavior/bugs/1381.zig");
_ = @import("behavior/bugs/1421.zig");

View File

@ -0,0 +1,24 @@
const std = @import("std");
const expect = std.testing.expect;
pub const VM = ?[*]const struct_InvocationTable_;
pub const struct_InvocationTable_ = extern struct {
GetVM: ?extern fn (?[*]VM) c_int,
};
pub const struct_VM_ = extern struct {
functions: ?[*]const struct_InvocationTable_,
};
//excised output from stdlib.h etc
pub const InvocationTable_ = struct_InvocationTable_;
pub const VM_ = struct_VM_;
extern fn agent_callback(_vm: [*]VM, options: [*]u8) i32 {
return 11;
}
test "fixed" {
expect(agent_callback(undefined, undefined) == 11);
}