Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zig test result hides printed output if it's missing a trailing newline #6856

Open
Sizik opened this issue Oct 28, 2020 · 2 comments
Open

zig test result hides printed output if it's missing a trailing newline #6856

Sizik opened this issue Oct 28, 2020 · 2 comments
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@Sizik
Copy link

Sizik commented Oct 28, 2020

print.zig:

const print = @import("std").debug.print;

test "print" {
    print("This prints,", .{});
    print("\nand this prints,\n", .{});
    print("but this doesn't!", .{});
}

Running zig test print.zig on Windows 7 gives the following command prompt output:

C:\>zig test print.zig
Test [1/1] test "print"... This prints,
and this prints,
All 1 tests passed.

I'd expect the last line to be either one of the following:

but this doesn't!All 1 tests passed.
but this doesn't!
All 1 tests passed.
@Sizik Sizik changed the title zig test result hides printed output if it's missing a newline zig test result hides printed output if it's missing a trailing newline Oct 28, 2020
@Vexu Vexu added enhancement Solving this issue will likely involve adding new logic or components to the codebase. standard library This issue involves writing Zig code for the standard library. labels Oct 28, 2020
@Vexu Vexu added this to the 0.8.0 milestone Oct 28, 2020
@LemonBoy
Copy link
Contributor

The test runner tries to be fancy by overwriting the Test [1/1] test <name> string as it goes trough the tests meaning that it may end up eating some of the user output... solving this problem in a satisfying way is non-trivial, if you (or anybody else) want to have a look the test runner is in lib/std/special/test_runner.zig.

@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 Nov 6, 2020
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 May 19, 2021
@dxps
Copy link
Contributor

dxps commented Mar 19, 2022

This looks similar with issue 4293, so probably it might be closed with the same (aforementioned) feedback.
To me, the print's output is hidden in a test run either way (with or without a newline).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

No branches or pull requests

5 participants