diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-12-25 15:36:35 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-12-26 19:58:56 -0800 |
| commit | 28639bd6d741ca96f384d85bbf40331664197068 (patch) | |
| tree | d799ba64d8f0bc736282609228815f9be038811c /lib/std/testing.zig | |
| parent | b0691df5ba898c8f6ac2c03e19e312502a2a0cc5 (diff) | |
| download | zig-28639bd6d741ca96f384d85bbf40331664197068.tar.gz zig-28639bd6d741ca96f384d85bbf40331664197068.zip | |
std: prevent testing.io from use outside tests
Diffstat (limited to 'lib/std/testing.zig')
| -rw-r--r-- | lib/std/testing.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 9519eeb427..733b54ec19 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -31,7 +31,7 @@ pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{ }; pub var io_instance: Io.Threaded = undefined; -pub const io = io_instance.io(); +pub const io = if (builtin.is_test) io_instance.io() else @compileError("not testing"); /// TODO https://github.com/ziglang/zig/issues/5738 pub var log_level = std.log.Level.warn; |
