authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-09 21:27:45-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-11 13:41:29-07:00
log9dc75f03e26146cb81fc992baf172202fcd19b17
tree5378b9a8b5b598951d2a3141eedbe0332273c217
parent2d005827b874f27535cda72c80b6558d9d4cd30c

fix init template for new fuzz testing API


1 files changed, 7 insertions(+), 3 deletions(-)

lib/init/src/main.zig+7-3
...@@ -27,7 +27,11 @@ test "simple test" {...@@ -27,7 +27,11 @@ test "simple test" {
27}27}
2828
29test "fuzz example" {29test "fuzz example" {
30 // Try passing `--fuzz` to `zig build test` and see if it manages to fail this test case!30 const global = struct {
31 const input_bytes = std.testing.fuzzInput(.{});31 fn testOne(input: []const u8) anyerror!void {
32 try std.testing.expect(!std.mem.eql(u8, "canyoufindme", input_bytes));32 // Try passing `--fuzz` to `zig build test` and see if it manages to fail this test case!
33 try std.testing.expect(!std.mem.eql(u8, "canyoufindme", input));
34 }
35 };
36 try std.testing.fuzz(global.testOne, .{});
33}37}