#"zig build test" hangs with a write to stdout

1 messages · Page 1 of 1 (latest)

wintry storm
wintry storm
#

it's open, but it still may not be solved in a way that allows you to write to stdout

#

you start at build.zig and can compile and run arbitrary programs under a test step

#

test blocks are more for unit tests indeed

surreal wolf
#

I just need to get on my soapbox a bit for this issue, because I think it's a bit silly.

Not in this thread, but on the github issue and more recently on a related Reddit thread, I'm a bit frustrated.

Some of the feedback about this issue has been worded as "why are you writing to stdout?" I'm surprised this use-case needs to be justified. As explained in the issue, this is broken because the build process is itself using stdout. Zig's own broken usage of stdout is a good example of why people might need access to stdout. (there's a bunch of other reasons, but this is the most obvious)

urban sundial
#

The issue has nothing to do with using stdout in a test block. The test suite will stall whenever the code tested is using stdout.

tame crater
#

hello, my only way that I found to do a test of an import made by me, is to take this import and put a main in it to have a test not as a build test but as a program with stds .debug.print etc...

on the other hand I would have liked to have a real debugger. (I tested several of them which very often do not understand the source)

urban sundial
#

At the end of the day, it is a design flaw in current test framework to assume that stdout is free.

untold ermine
#

update. I have deleted my messages upon realizing that they were inaccurate. sorry for the confusion.