fix test to use new zig api's
Some checks are pending
CI / Build (push) Blocked by required conditions
CI / Test (push) Waiting to run

This commit is contained in:
mikkelam 2025-11-17 16:09:10 +01:00
parent 32cd131037
commit 0066dff7c1
2 changed files with 6 additions and 6 deletions

View file

@ -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);

View file

@ -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,