Skip to content

Commit

Permalink
fix init template for new fuzz testing API
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk committed Sep 11, 2024
1 parent 2d00582 commit 9dc75f0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/init/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ test "simple test" {
}

test "fuzz example" {
// Try passing `--fuzz` to `zig build test` and see if it manages to fail this test case!
const input_bytes = std.testing.fuzzInput(.{});
try std.testing.expect(!std.mem.eql(u8, "canyoufindme", input_bytes));
const global = struct {
fn testOne(input: []const u8) anyerror!void {
// Try passing `--fuzz` to `zig build test` and see if it manages to fail this test case!
try std.testing.expect(!std.mem.eql(u8, "canyoufindme", input));
}
};
try std.testing.fuzz(global.testOne, .{});
}

0 comments on commit 9dc75f0

Please sign in to comment.