Skip to content

Commit e1b258f

Browse files
committed
add regression test for bug fixed by lazy values
closes #624
1 parent 8fef23a commit e1b258f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

test/stage1/behavior.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ comptime {
3232
_ = @import("behavior/bugs/394.zig");
3333
_ = @import("behavior/bugs/421.zig");
3434
_ = @import("behavior/bugs/529.zig");
35+
_ = @import("behavior/bugs/624.zig");
3536
_ = @import("behavior/bugs/655.zig");
3637
_ = @import("behavior/bugs/656.zig");
3738
_ = @import("behavior/bugs/679.zig");

test/stage1/behavior/bugs/624.zig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const std = @import("std");
2+
const expect = std.testing.expect;
3+
4+
const TestContext = struct {
5+
server_context: *ListenerContext,
6+
};
7+
8+
const ListenerContext = struct {
9+
context_alloc: *ContextAllocator,
10+
};
11+
12+
const ContextAllocator = MemoryPool(TestContext);
13+
14+
fn MemoryPool(comptime T: type) type {
15+
return struct {
16+
n: usize,
17+
};
18+
}
19+
20+
test "foo" {
21+
var allocator = ContextAllocator{ .n = 10 };
22+
expect(allocator.n == 10);
23+
}

0 commit comments

Comments
 (0)