From 0066dff7c179f8b0bb68c938d16f93e8eb3fea6e Mon Sep 17 00:00:00 2001 From: mikkelam Date: Mon, 17 Nov 2025 16:09:10 +0100 Subject: [PATCH] fix test to use new zig api's --- src/lib/fast.zig | 6 +++--- src/lib/workers/speed_worker.zig | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/fast.zig b/src/lib/fast.zig index 555a6a8..63ddce5 100644 --- a/src/lib/fast.zig +++ b/src/lib/fast.zig @@ -205,7 +205,7 @@ test "parse_response_urls_v2" { ; const allocator = testing.allocator; - const urls = try Fast.parse_response_urls(response, allocator); + var urls = try Fast.parse_response_urls(response, allocator); defer { for (urls.items) |url| { allocator.free(url); @@ -275,7 +275,7 @@ test "parse_response_without_isp" { ; const allocator = testing.allocator; - const urls = try Fast.parse_response_urls(response, allocator); + var urls = try Fast.parse_response_urls(response, allocator); defer { for (urls.items) |url| { allocator.free(url); @@ -293,7 +293,7 @@ test "parse_response_minimal_client" { ; const allocator = testing.allocator; - const urls = try Fast.parse_response_urls(response, allocator); + var urls = try Fast.parse_response_urls(response, allocator); defer { for (urls.items) |url| { allocator.free(url); diff --git a/src/lib/workers/speed_worker.zig b/src/lib/workers/speed_worker.zig index 63ad377..6c0a524 100644 --- a/src/lib/workers/speed_worker.zig +++ b/src/lib/workers/speed_worker.zig @@ -468,7 +468,7 @@ pub const MockHttpClient = struct { pub fn init(allocator: std.mem.Allocator) Self { return Self{ .allocator = allocator, - .responses = std.ArrayList(FetchResponse).init(allocator), + .responses = std.ArrayList(FetchResponse).empty, .request_count = std.atomic.Value(u32).init(0), }; } @@ -477,12 +477,12 @@ pub const MockHttpClient = struct { for (self.responses.items) |*response| { self.allocator.free(response.body); } - self.responses.deinit(); + self.responses.deinit(self.allocator); } pub fn addResponse(self: *Self, status: http.Status, body: []const u8) !void { const body_copy = try self.allocator.dupe(u8, body); - try self.responses.append(FetchResponse{ + try self.responses.append(self.allocator, FetchResponse{ .status = status, .body = body_copy, .allocator = self.allocator,