| ... | @@ -9,18 +9,20 @@ pub var random_seed: u32 = 0; | ... | @@ -9,18 +9,20 @@ pub var random_seed: u32 = 0; |
| 9 | | 9 | |
| 10 | pub const FailingAllocator = @import("testing/FailingAllocator.zig"); | 10 | pub const FailingAllocator = @import("testing/FailingAllocator.zig"); |
| 11 | pub const failing_allocator = failing_allocator_instance.allocator(); | 11 | pub const failing_allocator = failing_allocator_instance.allocator(); |
| 12 | pub var failing_allocator_instance = FailingAllocator.init(base_allocator_instance.allocator(), .{ .fail_index = 0 }); | 12 | var failing_allocator_instance = FailingAllocator.init(base_allocator_instance.allocator(), .{ |
| | 13 | .fail_index = 0, |
| | 14 | }); |
| | 15 | var base_allocator_instance = std.heap.FixedBufferAllocator.init(""); |
| 13 | | 16 | |
| 14 | /// This should only be used in temporary test programs. | 17 | /// This should only be used in temporary test programs. |
| 15 | pub const allocator = allocator_instance.allocator(); | 18 | pub const allocator = allocator_instance.allocator(); |
| 16 | pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{}) = b: { | 19 | pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{ |
| 17 | if (!builtin.is_test) | 20 | .stack_trace_frames = 10, |
| 18 | @compileError("Cannot use testing allocator outside of test block"); | 21 | }) = b: { |
| | 22 | if (!builtin.is_test) @compileError("testing allocator used when not testing"); |
| 19 | break :b .init; | 23 | break :b .init; |
| 20 | }; | 24 | }; |
| 21 | | 25 | |
| 22 | pub var base_allocator_instance = std.heap.FixedBufferAllocator.init(""); | | |
| 23 | | | |
| 24 | /// TODO https://github.com/ziglang/zig/issues/5738 | 26 | /// TODO https://github.com/ziglang/zig/issues/5738 |
| 25 | pub var log_level = std.log.Level.warn; | 27 | pub var log_level = std.log.Level.warn; |
| 26 | | 28 | |