Commit 9dc75f03e2

Andrew Kelley <andrew@ziglang.org>
2024-09-10 06:27:45
fix init template for new fuzz testing API
1 parent 2d00582
Changed files (1)
lib
init
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, .{});
 }