mirror of
https://github.com/mikkelam/fast-cli.git
synced 2025-12-16 20:04:05 +00:00
fix test to use new zig api's
This commit is contained in:
parent
32cd131037
commit
0066dff7c1
2 changed files with 6 additions and 6 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue