zig/test/behavior/bugs/624.zig

31 lines
741 B
Zig

const std = @import("std");
const builtin = @import("builtin");
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 {
_ = T;
return struct {
n: usize,
};
}
test "foo" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
var allocator = ContextAllocator{ .n = 10 };
_ = &allocator;
try expect(allocator.n == 10);
}