Hi, I am learning zig and couldn’t find any information about why test/standalone/simple/cat/main.zig panics on run in version 0.15.1, but in 0.14.1 it works properly.
/.../zig/std/debug.zig:559:14: 0x102e0fe07 in assert (...)
if (!ok) unreachable; // assertion failure
^
/.../zig/0.15.1/lib/zig/std/Io/Writer.zig:939:11: 0x102ea2bb7 in sendFileAll (...)
assert(w.buffer.len > 0);
^
/.../src/main.zig:35:39: 0x102ea28df in main (..)
_ = try stdout.sendFileAll(&file_reader, .unlimited);
^
Is my assumption correct that the goal was to have a buildable example for testing, not an actually working one or is this is degradation after 0.15 release and it should be fixed?
Hi @dimdin, thanks! Yes, have spotted the fix by reading examples in zig’s src/main.zig Also, since there is now a buffer in stdout_writer we should call stdout.flush() after each sendFileAll call. The main question was: should I send a fix to upstream, or is this intended? The more I look at the 0.14.1 version the more I believe this is an oversight.
P.S. Sorry if my message sounds crude, I am not a native speaker and mean everything written in the best way possible)
I believe the test is not disabled, but looks like standalone test suit is just builds the file and doesn’t have any verification if the program itself works