Closed orhun closed 1 month ago
Describe the bug
The "run" test was removed in #28 and we should add it back!
To reproduce
Add the following test:
test "run" { const allocator = std.testing.allocator; var buffer = std.ArrayList(u8).init(allocator); const output = buffer.writer(); try run(allocator, output); const result = buffer.toOwnedSlice(); defer allocator.free(result); try std.testing.expectEqualStrings( \\Reading 96 bytes from /dev/urandom \\Saving to output.wav \\ , result); }
And run zig build test --summary all
zig build test --summary all
$ zig build test --summary all test └─ run main-tests └─ zig test main-tests Debug native 1 errors src/main.zig:112:7: error: expected type '[]const u8', found 'error{OutOfMemory}![]u8' , result); ^~~~~~ /usr/lib/zig/std/testing.zig:602:57: note: parameter type declared here pub fn expectEqualStrings(expected: []const u8, actual: []const u8) !void { ^~~~~~~~~~ error: the following command failed with 1 compilation errors: /usr/bin/zig test -ODebug --dep clap --dep file --dep gen --dep wav --dep build_options -Mroot=/home/orhun/gh/linuxwave/src/main.zig -Mclap=/home/orhun/.cache/zig/p/122062d301a203d003547b414237229b09a7980095061697349f8bef41be9c30266b/clap.zig -Mfile=/home/orhun/gh/linuxwave/src/file.zig -Mgen=/home/orhun/gh/linuxwave/src/gen.zig -Mwav=/home/orhun/gh/linuxwave/src/wav.zig -Mbuild_options=/home/orhun/gh/linuxwave/.zig-cache/c/39ab14edd4b808fc84a6290cbce71a92/options.zig --cache-dir /home/orhun/gh/linuxwave/.zig-cache --global-cache-dir /home/orhun/.cache/zig --name main-tests --listen=- Build Summary: 7/10 steps succeeded; 1 failed test transitive failure ├─ run file-tests cached │ └─ zig test file-tests Debug native cached 24ms MaxRSS:43M │ └─ options cached ├─ run gen-tests cached │ └─ zig test gen-tests Debug native cached 26ms MaxRSS:43M │ └─ options (reused) ├─ run wav-tests cached │ └─ zig test wav-tests Debug native cached 24ms MaxRSS:43M │ └─ options (reused) └─ run main-tests transitive failure └─ zig test main-tests Debug native 1 errors └─ options (reused) error: the following build command failed with exit code 1: /home/orhun/gh/linuxwave/.zig-cache/o/afb7cc6a9f9ac5c36087ee47fee4d7b5/build /usr/bin/zig /home/orhun/gh/linuxwave /home/orhun/gh/linuxwave/.zig-cache /home/orhun/.cache/zig --seed 0x437fe8a7 -Za0187a4813cc29b8 test --summary all
Expected behavior
Passed tests.
Software information
Additional context
Shoutout to @tranzystorekk
Describe the bug
The "run" test was removed in #28 and we should add it back!
To reproduce
Add the following test:
And run
zig build test --summary all
Expected behavior
Passed tests.
Software information
Additional context
Shoutout to @tranzystorekk