diff options
| author | Benjamin Feng <benjamin.feng@glassdoor.com> | 2020-01-29 12:21:29 -0600 |
|---|---|---|
| committer | Benjamin Feng <benjamin.feng@glassdoor.com> | 2020-01-29 12:21:29 -0600 |
| commit | 4d134a01f5a8baae346783f19d9b5db8c8256d32 (patch) | |
| tree | aa75eac95360a47502c3a278329d2d775d53d571 /lib/std/testing.zig | |
| parent | 34706dad3ff22f73197fbf5e9cbf4628f698a74d (diff) | |
| download | zig-4d134a01f5a8baae346783f19d9b5db8c8256d32.tar.gz zig-4d134a01f5a8baae346783f19d9b5db8c8256d32.zip | |
Move debug.global_allocator to testing.allocator
Diffstat (limited to 'lib/std/testing.zig')
| -rw-r--r-- | lib/std/testing.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 7a261e0751..02d7cdb393 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -2,6 +2,11 @@ const builtin = @import("builtin"); const TypeId = builtin.TypeId; const std = @import("std.zig"); +/// This should only be used in temporary test programs. +pub const allocator = &allocator_instance.allocator; +pub var allocator_instance = std.heap.ThreadSafeFixedBufferAllocator.init(allocator_mem[0..]); +var allocator_mem: [100 * 1024]u8 = undefined; + /// This function is intended to be used only in tests. It prints diagnostics to stderr /// and then aborts when actual_error_union is not expected_error. pub fn expectError(expected_error: anyerror, actual_error_union: var) void { |
