From 9dc75f03e26146cb81fc992baf172202fcd19b17 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 9 Sep 2024 21:27:45 -0700 Subject: [PATCH] fix init template for new fuzz testing API --- lib/init/src/main.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/init/src/main.zig b/lib/init/src/main.zig index 0c4bb73429..ba5a2ccef2 100644 --- a/lib/init/src/main.zig +++ b/lib/init/src/main.zig @@ -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, .{}); }