| author | |
| committer | |
| log | b5770541bdc10311125a06ab2ef1b7f3546cea7a |
| tree | 0fe86cadab60847fe058c008b3dc2493bc5c4db7 |
| parent | 790d28d6cd9029805af857d56645a6ce191bfe91 |
2 files changed, 5 insertions(+), 0 deletions(-)
lib/compiler/test_runner.zig+2| ... | ... | @@ -129,6 +129,7 @@ fn mainServer(init: std.process.Init.Minimal) !void { |
| 129 | 129 | }, |
| 130 | 130 | |
| 131 | 131 | .run_test => { |
| 132 | testing.environ = init.environ; | |
| 132 | 133 | testing.allocator_instance = .{}; |
| 133 | 134 | testing.io_instance = .init(testing.allocator, .{ |
| 134 | 135 | .argv0 = .init(init.args), |
| ... | ... | @@ -244,6 +245,7 @@ fn mainTerminal(init: std.process.Init.Minimal) void { |
| 244 | 245 | if (testing.allocator_instance.deinit() == .leak) leaks += 1; |
| 245 | 246 | } |
| 246 | 247 | testing.log_level = .warn; |
| 248 | testing.environ = init.environ; | |
| 247 | 249 | |
| 248 | 250 | const test_node = root_node.start(test_fn.name, 0); |
| 249 | 251 | if (!have_tty) { |
lib/std/testing.zig+3| ... | ... | @@ -2,6 +2,7 @@ const builtin = @import("builtin"); |
| 2 | 2 | |
| 3 | 3 | const std = @import("std.zig"); |
| 4 | 4 | const Io = std.Io; |
| 5 | const Environ = std.process.Environ; | |
| 5 | 6 | const assert = std.debug.assert; |
| 6 | 7 | const math = std.math; |
| 7 | 8 | |
| ... | ... | @@ -33,6 +34,8 @@ pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{ |
| 33 | 34 | pub var io_instance: Io.Threaded = undefined; |
| 34 | 35 | pub const io = if (builtin.is_test) io_instance.io() else @compileError("not testing"); |
| 35 | 36 | |
| 37 | pub var environ: Environ = if (builtin.is_test) undefined else @compileError("not testing"); | |
| 38 | ||
| 36 | 39 | /// TODO https://github.com/ziglang/zig/issues/5738 |
| 37 | 40 | pub var log_level = std.log.Level.warn; |
| 38 | 41 |