Skip to content

Commit 070074c

Browse files
committed
get tests working in 0.16
1 parent 46faba4 commit 070074c

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

build.zig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub fn build(b: *std.Build) void {
4444

4545
const exe_unit_tests = b.addTest(.{
4646
.root_module = exe_mod,
47+
.use_llvm = true,
4748
});
4849

4950
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
@@ -64,7 +65,9 @@ pub fn build(b: *std.Build) void {
6465
.root_source_file = b.path(zig_file),
6566
.target = target,
6667
.optimize = optimize,
68+
.link_libc = true,
6769
}),
70+
.use_llvm = true,
6871
});
6972

7073
// Add dependencies to individual test artifacts

src/httpfile/http_client.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ pub fn printResponse(response: *const HttpResponse) void {
159159
test "HttpClient basic functionality" {
160160
const allocator = std.testing.allocator;
161161

162-
var client = HttpClient.init(allocator);
162+
var client = HttpClient.init(std.testing.io, allocator);
163163
defer client.deinit();
164164

165165
var request = httpfiles.HttpRequest.init();

src/httpfile/parser.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ test "HttpParser from String Contents" {
225225
try std.testing.expectEqualStrings("Bearer ABC123", requests.items[0].headers.items[1].value);
226226
try std.testing.expectEqualStrings("Authorization", requests.items[1].headers.items[1].name);
227227
try std.testing.expectEqualStrings("Bearer ABC123", requests.items[1].headers.items[1].value);
228-
try std.testing.expectEqualStrings("TEST NAME", requests.items[1].name orelse "");
229-
try std.testing.expectEqual(0, (requests.items[0].body orelse "").len);
230-
try std.testing.expect(0 != (requests.items[1].body orelse "").len);
228+
try std.testing.expectEqualStrings("TEST NAME", requests.items[1].name orelse unreachable);
229+
try std.testing.expectEqual(null, requests.items[0].body);
230+
try std.testing.expect(0 != (requests.items[1].body orelse unreachable).len);
231231
}
232232

233233
test "HttpParser parses assertions" {
@@ -252,5 +252,5 @@ test "HttpParser parses assertions" {
252252
try std.testing.expectEqualStrings("status", requests.items[0].assertions.items[0].key);
253253
try std.testing.expectEqual(AssertionType.equal, requests.items[0].assertions.items[0].assertion_type);
254254
try std.testing.expectEqualStrings("200", requests.items[0].assertions.items[0].value);
255-
try std.testing.expectEqual(0, (requests.items[0].body orelse "").len);
255+
try std.testing.expectEqual(null, requests.items[0].body);
256256
}

0 commit comments

Comments
 (0)