Why am I getting false positive upon printing in test

I tried using an std.Io,File.stdout() in a test, but that just made it hang. After I swapped to stderr() I’m getting false positive.
Test in question:

test "Time struct formatting" {
    var arena_allocator = heap.ArenaAllocator.init(std.heap.page_allocator);
    defer arena_allocator.deinit();
    const alloc = arena_allocator.allocator();

    // Setup IO (Required for clock.now)
    var io_init = std.Io.Threaded.init(alloc, .{ .environ = .empty });
    const io = io_init.io();

    var t = std.debug.lockStderr(&.{}).terminal();
    const writer = t.writer;

    //  Create the Time instance
    const tnow = Time.create(io);

    // Test 'now()'
    try writer.print("{f}\n", .{tnow.fmt(.now)});
    try writer.flush();

    //  Test 'syslog()'
    try writer.print("{f}\n", .{tnow.fmt(.syslog)});
    try writer.flush();
}

Result

j.markovic@MacBook-Pro-2 ~/GIT/wg-forwarder/src (git)-[0.16] % zig build test
test
└─ run test w
2026-01-14 21:40:02.984
Jan 14 21:40:02
failed command: /Users/j.markovic/GIT/wg-forwarder/.zig-cache/o/fba84e2a50f15a5f890340a18b20380d/test --cache-dir=/Users/
j.markovic/GIT/wg-forwarder/.zig-cache --seed=0x7805701c --listen=-

Any way to print stuff in testing with out getting false positive?

You’re testing the code to print to the terminal, which is not what you want to test.
Create a fixed buffer in the test, write to it, and then compare if it is what you wanted to write.

What do you mean by a false positive?

It says failed command in a result, even though nothing failed in a test

Yes, I know that works, and I can assert the buffer size, since I cannot assert the value of time. I just thought that there is maybe a way to print the output with out actually displaying it as “failed command: …” after

The tester considers the test case failed if you log above std.testing.log_level or you write using stderr.