authorgravatar for aleksey.kladov@gmail.comAlex Kladov <aleksey.kladov@gmail.com> 2025-07-14 17:32:50+01:00
committergravatar for aleksey.kladov@gmail.comAlex Kladov <aleksey.kladov@gmail.com> 2025-07-14 17:32:50+01:00
log96bb1137c23688f01283be24ac9b52e1440afded
tree51a20754b41561cec76344d92f6392f746578a86
parentd045eb7a4af758e3483e5e8fd9bdbe725095fdec

langref: don't encourage printing to stderr in tests

The rule: `pub fn main` owns file descriptors 0, 1, and 2. If you didn't write `pub fn main()` it is, in general, not your business to print to stderr.

2 files changed, 4 insertions(+), 4 deletions(-)

doc/langref/defer_unwind.zig+2-2
......@@ -2,7 +2,7 @@ const std = @import("std");
22const expect = std.testing.expect;
33const print = std.debug.print;
44
5test "defer unwinding" {
5pub fn main() void {
66 print("\n", .{});
77
88 defer {
......@@ -19,4 +19,4 @@ test "defer unwinding" {
1919 }
2020}
2121
22// test
22// exe=succeed
doc/langref/inline_call.zig+2-2
......@@ -1,6 +1,6 @@
11const std = @import("std");
22
3test "inline function call" {
3pub fn main() void {
44 if (foo(1200, 34) != 1234) {
55 @compileError("bad");
66 }
......@@ -11,4 +11,4 @@ inline fn foo(a: i32, b: i32) i32 {
1111 return a + b;
1212}
1313
14// test
14// exe=succeed