| author | |
| committer | |
| log | 7a92d878ee9739b7c67be09904f332fad1f1fdaa |
| tree | d20ae5e58cec3989118fafbd2e1d704cc2ba4bc2 |
| parent | a16a1a608262e9881e127922c8f27921c4af8407 |
prevents leak logs in test results2 files changed, 8 insertions(+), 4 deletions(-)
generate.ts+4-2| ... | ... | @@ -61,10 +61,11 @@ const E = stringEscape; |
| 61 | 61 | w.write(` |
| 62 | 62 | pub fn parseFail(input: []const u8, base: ?[]const u8) !void { |
| 63 | 63 | const allocator = std.testing.allocator; |
| 64 | _ = url.URL.parse(allocator, input, base) catch |err| switch (err) { | |
| 64 | const u = url.URL.parse(allocator, input, base) catch |err| switch (err) { | |
| 65 | 65 | error.InvalidURL => return, |
| 66 | 66 | error.OutOfMemory => return error.OutOfMemory, |
| 67 | 67 | }; |
| 68 | defer allocator.free(u.href); | |
| 68 | 69 | return error.FailZigTest; |
| 69 | 70 | } |
| 70 | 71 | |
| ... | ... | @@ -87,10 +88,11 @@ pub fn parsePass(input: []const u8, base: ?[]const u8, href: []const u8, origin: |
| 87 | 88 | |
| 88 | 89 | pub fn parseIDNAFail(comptime input: []const u8) !void { |
| 89 | 90 | const allocator = std.testing.allocator; |
| 90 | _ = url.URL.parse(allocator, "https://" ++ input ++ "/x", null) catch |err| switch (err) { | |
| 91 | const u = url.URL.parse(allocator, "https://" ++ input ++ "/x", null) catch |err| switch (err) { | |
| 91 | 92 | error.InvalidURL => return, |
| 92 | 93 | error.OutOfMemory => return error.OutOfMemory, |
| 93 | 94 | }; |
| 95 | defer allocator.free(u.href); | |
| 94 | 96 | return error.FailZigTest; |
| 95 | 97 | } |
| 96 | 98 |
zig-out/test.zig+4-2| ... | ... | @@ -6,10 +6,11 @@ const expect = @import("expect").expect; |
| 6 | 6 | |
| 7 | 7 | pub fn parseFail(input: []const u8, base: ?[]const u8) !void { |
| 8 | 8 | const allocator = std.testing.allocator; |
| 9 | _ = url.URL.parse(allocator, input, base) catch |err| switch (err) { | |
| 9 | const u = url.URL.parse(allocator, input, base) catch |err| switch (err) { | |
| 10 | 10 | error.InvalidURL => return, |
| 11 | 11 | error.OutOfMemory => return error.OutOfMemory, |
| 12 | 12 | }; |
| 13 | defer allocator.free(u.href); | |
| 13 | 14 | return error.FailZigTest; |
| 14 | 15 | } |
| 15 | 16 | |
| ... | ... | @@ -32,10 +33,11 @@ pub fn parsePass(input: []const u8, base: ?[]const u8, href: []const u8, origin: |
| 32 | 33 | |
| 33 | 34 | pub fn parseIDNAFail(comptime input: []const u8) !void { |
| 34 | 35 | const allocator = std.testing.allocator; |
| 35 | _ = url.URL.parse(allocator, "https://" ++ input ++ "/x", null) catch |err| switch (err) { | |
| 36 | const u = url.URL.parse(allocator, "https://" ++ input ++ "/x", null) catch |err| switch (err) { | |
| 36 | 37 | error.InvalidURL => return, |
| 37 | 38 | error.OutOfMemory => return error.OutOfMemory, |
| 38 | 39 | }; |
| 40 | defer allocator.free(u.href); | |
| 39 | 41 | return error.FailZigTest; |
| 40 | 42 | } |
| 41 | 43 |