-
-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
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
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 allExpected behavior
Passed tests.
Software information
- Operating system: arch btw
- Zig version: 0.13
- Project version: main
Additional context
Shoutout to @tranzystorekk
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed