add regression test for bug fixed by lazy values

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

View File

@ -32,6 +32,7 @@ comptime {
_ = @import("behavior/bugs/394.zig");
_ = @import("behavior/bugs/421.zig");
_ = @import("behavior/bugs/529.zig");
_ = @import("behavior/bugs/624.zig");
_ = @import("behavior/bugs/655.zig");
_ = @import("behavior/bugs/656.zig");
_ = @import("behavior/bugs/679.zig");

View File

@ -0,0 +1,23 @@
const std = @import("std");
const expect = std.testing.expect;
const TestContext = struct {
server_context: *ListenerContext,
};
const ListenerContext = struct {
context_alloc: *ContextAllocator,
};
const ContextAllocator = MemoryPool(TestContext);
fn MemoryPool(comptime T: type) type {
return struct {
n: usize,
};
}
test "foo" {
var allocator = ContextAllocator{ .n = 10 };
expect(allocator.n == 10);
}