authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-05-05 21:29:16+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-05-08 15:15:30+03:00
log42a95197f32b46ee7b504282ab345209cb43c247
tree46e44b0dde19d9aa27c27dacf7ed6a3634d62d29
parent0a38f61d58018ce856ce058efb655ff0199228d2

update usage of std.testing in stage2


13 files changed, 139 insertions(+), 139 deletions(-)

src/Cache.zig+18-18
......@@ -727,7 +727,7 @@ test "cache file and then recall it" {
727727 _ = try ch.addFile(temp_file, null);
728728
729729 // There should be nothing in the cache
730 testing.expectEqual(false, try ch.hit());
730 try testing.expectEqual(false, try ch.hit());
731731
732732 digest1 = ch.final();
733733 try ch.writeManifest();
......@@ -742,13 +742,13 @@ test "cache file and then recall it" {
742742 _ = try ch.addFile(temp_file, null);
743743
744744 // Cache hit! We just "built" the same file
745 testing.expect(try ch.hit());
745 try testing.expect(try ch.hit());
746746 digest2 = ch.final();
747747
748748 try ch.writeManifest();
749749 }
750750
751 testing.expectEqual(digest1, digest2);
751 try testing.expectEqual(digest1, digest2);
752752 }
753753
754754 try cwd.deleteTree(temp_manifest_dir);
......@@ -760,11 +760,11 @@ test "give problematic timestamp" {
760760 // to make it problematic, we make it only accurate to the second
761761 fs_clock = @divTrunc(fs_clock, std.time.ns_per_s);
762762 fs_clock *= std.time.ns_per_s;
763 testing.expect(isProblematicTimestamp(fs_clock));
763 try testing.expect(isProblematicTimestamp(fs_clock));
764764}
765765
766766test "give nonproblematic timestamp" {
767 testing.expect(!isProblematicTimestamp(std.time.nanoTimestamp() - std.time.ns_per_s));
767 try testing.expect(!isProblematicTimestamp(std.time.nanoTimestamp() - std.time.ns_per_s));
768768}
769769
770770test "check that changing a file makes cache fail" {
......@@ -807,9 +807,9 @@ test "check that changing a file makes cache fail" {
807807 const temp_file_idx = try ch.addFile(temp_file, 100);
808808
809809 // There should be nothing in the cache
810 testing.expectEqual(false, try ch.hit());
810 try testing.expectEqual(false, try ch.hit());
811811
812 testing.expect(mem.eql(u8, original_temp_file_contents, ch.files.items[temp_file_idx].contents.?));
812 try testing.expect(mem.eql(u8, original_temp_file_contents, ch.files.items[temp_file_idx].contents.?));
813813
814814 digest1 = ch.final();
815815
......@@ -826,17 +826,17 @@ test "check that changing a file makes cache fail" {
826826 const temp_file_idx = try ch.addFile(temp_file, 100);
827827
828828 // A file that we depend on has been updated, so the cache should not contain an entry for it
829 testing.expectEqual(false, try ch.hit());
829 try testing.expectEqual(false, try ch.hit());
830830
831831 // The cache system does not keep the contents of re-hashed input files.
832 testing.expect(ch.files.items[temp_file_idx].contents == null);
832 try testing.expect(ch.files.items[temp_file_idx].contents == null);
833833
834834 digest2 = ch.final();
835835
836836 try ch.writeManifest();
837837 }
838838
839 testing.expect(!mem.eql(u8, digest1[0..], digest2[0..]));
839 try testing.expect(!mem.eql(u8, digest1[0..], digest2[0..]));
840840 }
841841
842842 try cwd.deleteTree(temp_manifest_dir);
......@@ -868,7 +868,7 @@ test "no file inputs" {
868868 ch.hash.addBytes("1234");
869869
870870 // There should be nothing in the cache
871 testing.expectEqual(false, try ch.hit());
871 try testing.expectEqual(false, try ch.hit());
872872
873873 digest1 = ch.final();
874874
......@@ -880,12 +880,12 @@ test "no file inputs" {
880880
881881 ch.hash.addBytes("1234");
882882
883 testing.expect(try ch.hit());
883 try testing.expect(try ch.hit());
884884 digest2 = ch.final();
885885 try ch.writeManifest();
886886 }
887887
888 testing.expectEqual(digest1, digest2);
888 try testing.expectEqual(digest1, digest2);
889889}
890890
891891test "Manifest with files added after initial hash work" {
......@@ -926,7 +926,7 @@ test "Manifest with files added after initial hash work" {
926926 _ = try ch.addFile(temp_file1, null);
927927
928928 // There should be nothing in the cache
929 testing.expectEqual(false, try ch.hit());
929 try testing.expectEqual(false, try ch.hit());
930930
931931 _ = try ch.addFilePost(temp_file2);
932932
......@@ -940,12 +940,12 @@ test "Manifest with files added after initial hash work" {
940940 ch.hash.addBytes("1234");
941941 _ = try ch.addFile(temp_file1, null);
942942
943 testing.expect(try ch.hit());
943 try testing.expect(try ch.hit());
944944 digest2 = ch.final();
945945
946946 try ch.writeManifest();
947947 }
948 testing.expect(mem.eql(u8, &digest1, &digest2));
948 try testing.expect(mem.eql(u8, &digest1, &digest2));
949949
950950 // Modify the file added after initial hash
951951 const ts2 = std.time.nanoTimestamp();
......@@ -963,7 +963,7 @@ test "Manifest with files added after initial hash work" {
963963 _ = try ch.addFile(temp_file1, null);
964964
965965 // A file that we depend on has been updated, so the cache should not contain an entry for it
966 testing.expectEqual(false, try ch.hit());
966 try testing.expectEqual(false, try ch.hit());
967967
968968 _ = try ch.addFilePost(temp_file2);
969969
......@@ -972,7 +972,7 @@ test "Manifest with files added after initial hash work" {
972972 try ch.writeManifest();
973973 }
974974
975 testing.expect(!mem.eql(u8, &digest1, &digest3));
975 try testing.expect(!mem.eql(u8, &digest1, &digest3));
976976 }
977977
978978 try cwd.deleteTree(temp_manifest_dir);
src/Compilation.zig+8-8
......@@ -2852,14 +2852,14 @@ pub fn classifyFileExt(filename: []const u8) FileExt {
28522852}
28532853
28542854test "classifyFileExt" {
2855 std.testing.expectEqual(FileExt.cpp, classifyFileExt("foo.cc"));
2856 std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.nim"));
2857 std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so"));
2858 std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1"));
2859 std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2"));
2860 std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2.3"));
2861 std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.so.1.2.3~"));
2862 std.testing.expectEqual(FileExt.zig, classifyFileExt("foo.zig"));
2855 try std.testing.expectEqual(FileExt.cpp, classifyFileExt("foo.cc"));
2856 try std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.nim"));
2857 try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so"));
2858 try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1"));
2859 try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2"));
2860 try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2.3"));
2861 try std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.so.1.2.3~"));
2862 try std.testing.expectEqual(FileExt.zig, classifyFileExt("foo.zig"));
28632863}
28642864
28652865fn haveFramePointer(comp: *const Compilation) bool {
src/DepTokenizer.zig+2-2
......@@ -918,7 +918,7 @@ fn depTokenizer(input: []const u8, expect: []const u8) !void {
918918 }
919919
920920 if (std.mem.eql(u8, expect, buffer.items)) {
921 testing.expect(true);
921 try testing.expect(true);
922922 return;
923923 }
924924
......@@ -930,7 +930,7 @@ fn depTokenizer(input: []const u8, expect: []const u8) !void {
930930 try printSection(out, ">>>> got", buffer.items);
931931 try printRuler(out);
932932
933 testing.expect(false);
933 try testing.expect(false);
934934}
935935
936936fn printSection(out: anytype, label: []const u8, bytes: []const u8) !void {
src/codegen/aarch64.zig+34-34
......@@ -67,27 +67,27 @@ pub const c_abi_int_param_regs = [_]Register{ .x0, .x1, .x2, .x3, .x4, .x5, .x6,
6767pub const c_abi_int_return_regs = [_]Register{ .x0, .x1, .x2, .x3, .x4, .x5, .x6, .x7 };
6868
6969test "Register.id" {
70 testing.expectEqual(@as(u5, 0), Register.x0.id());
71 testing.expectEqual(@as(u5, 0), Register.w0.id());
70 try testing.expectEqual(@as(u5, 0), Register.x0.id());
71 try testing.expectEqual(@as(u5, 0), Register.w0.id());
7272
73 testing.expectEqual(@as(u5, 31), Register.xzr.id());
74 testing.expectEqual(@as(u5, 31), Register.wzr.id());
73 try testing.expectEqual(@as(u5, 31), Register.xzr.id());
74 try testing.expectEqual(@as(u5, 31), Register.wzr.id());
7575
76 testing.expectEqual(@as(u5, 31), Register.sp.id());
77 testing.expectEqual(@as(u5, 31), Register.sp.id());
76 try testing.expectEqual(@as(u5, 31), Register.sp.id());
77 try testing.expectEqual(@as(u5, 31), Register.sp.id());
7878}
7979
8080test "Register.size" {
81 testing.expectEqual(@as(u7, 64), Register.x19.size());
82 testing.expectEqual(@as(u7, 32), Register.w3.size());
81 try testing.expectEqual(@as(u7, 64), Register.x19.size());
82 try testing.expectEqual(@as(u7, 32), Register.w3.size());
8383}
8484
8585test "Register.to64/to32" {
86 testing.expectEqual(Register.x0, Register.w0.to64());
87 testing.expectEqual(Register.x0, Register.x0.to64());
86 try testing.expectEqual(Register.x0, Register.w0.to64());
87 try testing.expectEqual(Register.x0, Register.x0.to64());
8888
89 testing.expectEqual(Register.w3, Register.w3.to32());
90 testing.expectEqual(Register.w3, Register.x3.to32());
89 try testing.expectEqual(Register.w3, Register.w3.to32());
90 try testing.expectEqual(Register.w3, Register.x3.to32());
9191}
9292
9393// zig fmt: off
......@@ -169,33 +169,33 @@ pub const FloatingPointRegister = enum(u8) {
169169// zig fmt: on
170170
171171test "FloatingPointRegister.id" {
172 testing.expectEqual(@as(u5, 0), FloatingPointRegister.b0.id());
173 testing.expectEqual(@as(u5, 0), FloatingPointRegister.h0.id());
174 testing.expectEqual(@as(u5, 0), FloatingPointRegister.s0.id());
175 testing.expectEqual(@as(u5, 0), FloatingPointRegister.d0.id());
176 testing.expectEqual(@as(u5, 0), FloatingPointRegister.q0.id());
177
178 testing.expectEqual(@as(u5, 2), FloatingPointRegister.q2.id());
179 testing.expectEqual(@as(u5, 31), FloatingPointRegister.d31.id());
172 try testing.expectEqual(@as(u5, 0), FloatingPointRegister.b0.id());
173 try testing.expectEqual(@as(u5, 0), FloatingPointRegister.h0.id());
174 try testing.expectEqual(@as(u5, 0), FloatingPointRegister.s0.id());
175 try testing.expectEqual(@as(u5, 0), FloatingPointRegister.d0.id());
176 try testing.expectEqual(@as(u5, 0), FloatingPointRegister.q0.id());
177
178 try testing.expectEqual(@as(u5, 2), FloatingPointRegister.q2.id());
179 try testing.expectEqual(@as(u5, 31), FloatingPointRegister.d31.id());
180180}
181181
182182test "FloatingPointRegister.size" {
183 testing.expectEqual(@as(u8, 128), FloatingPointRegister.q1.size());
184 testing.expectEqual(@as(u8, 64), FloatingPointRegister.d2.size());
185 testing.expectEqual(@as(u8, 32), FloatingPointRegister.s3.size());
186 testing.expectEqual(@as(u8, 16), FloatingPointRegister.h4.size());
187 testing.expectEqual(@as(u8, 8), FloatingPointRegister.b5.size());
183 try testing.expectEqual(@as(u8, 128), FloatingPointRegister.q1.size());
184 try testing.expectEqual(@as(u8, 64), FloatingPointRegister.d2.size());
185 try testing.expectEqual(@as(u8, 32), FloatingPointRegister.s3.size());
186 try testing.expectEqual(@as(u8, 16), FloatingPointRegister.h4.size());
187 try testing.expectEqual(@as(u8, 8), FloatingPointRegister.b5.size());
188188}
189189
190190test "FloatingPointRegister.toX" {
191 testing.expectEqual(FloatingPointRegister.q1, FloatingPointRegister.q1.to128());
192 testing.expectEqual(FloatingPointRegister.q2, FloatingPointRegister.b2.to128());
193 testing.expectEqual(FloatingPointRegister.q3, FloatingPointRegister.h3.to128());
194
195 testing.expectEqual(FloatingPointRegister.d0, FloatingPointRegister.q0.to64());
196 testing.expectEqual(FloatingPointRegister.s1, FloatingPointRegister.d1.to32());
197 testing.expectEqual(FloatingPointRegister.h2, FloatingPointRegister.s2.to16());
198 testing.expectEqual(FloatingPointRegister.b3, FloatingPointRegister.h3.to8());
191 try testing.expectEqual(FloatingPointRegister.q1, FloatingPointRegister.q1.to128());
192 try testing.expectEqual(FloatingPointRegister.q2, FloatingPointRegister.b2.to128());
193 try testing.expectEqual(FloatingPointRegister.q3, FloatingPointRegister.h3.to128());
194
195 try testing.expectEqual(FloatingPointRegister.d0, FloatingPointRegister.q0.to64());
196 try testing.expectEqual(FloatingPointRegister.s1, FloatingPointRegister.d1.to32());
197 try testing.expectEqual(FloatingPointRegister.h2, FloatingPointRegister.s2.to16());
198 try testing.expectEqual(FloatingPointRegister.b3, FloatingPointRegister.h3.to8());
199199}
200200
201201/// Represents an instruction in the AArch64 instruction set
......@@ -1225,6 +1225,6 @@ test "serialize instructions" {
12251225
12261226 for (testcases) |case| {
12271227 const actual = case.inst.toU32();
1228 testing.expectEqual(case.expected, actual);
1228 try testing.expectEqual(case.expected, actual);
12291229 }
12301230}
src/codegen/arm.zig+12-12
......@@ -88,19 +88,19 @@ pub const Condition = enum(u4) {
8888};
8989
9090test "condition from CompareOperator" {
91 testing.expectEqual(@as(Condition, .eq), Condition.fromCompareOperatorSigned(.eq));
92 testing.expectEqual(@as(Condition, .eq), Condition.fromCompareOperatorUnsigned(.eq));
91 try testing.expectEqual(@as(Condition, .eq), Condition.fromCompareOperatorSigned(.eq));
92 try testing.expectEqual(@as(Condition, .eq), Condition.fromCompareOperatorUnsigned(.eq));
9393
94 testing.expectEqual(@as(Condition, .gt), Condition.fromCompareOperatorSigned(.gt));
95 testing.expectEqual(@as(Condition, .hi), Condition.fromCompareOperatorUnsigned(.gt));
94 try testing.expectEqual(@as(Condition, .gt), Condition.fromCompareOperatorSigned(.gt));
95 try testing.expectEqual(@as(Condition, .hi), Condition.fromCompareOperatorUnsigned(.gt));
9696
97 testing.expectEqual(@as(Condition, .le), Condition.fromCompareOperatorSigned(.lte));
98 testing.expectEqual(@as(Condition, .ls), Condition.fromCompareOperatorUnsigned(.lte));
97 try testing.expectEqual(@as(Condition, .le), Condition.fromCompareOperatorSigned(.lte));
98 try testing.expectEqual(@as(Condition, .ls), Condition.fromCompareOperatorUnsigned(.lte));
9999}
100100
101101test "negate condition" {
102 testing.expectEqual(@as(Condition, .eq), Condition.ne.negate());
103 testing.expectEqual(@as(Condition, .ne), Condition.eq.negate());
102 try testing.expectEqual(@as(Condition, .eq), Condition.ne.negate());
103 try testing.expectEqual(@as(Condition, .ne), Condition.eq.negate());
104104}
105105
106106/// Represents a register in the ARM instruction set architecture
......@@ -175,8 +175,8 @@ pub const Register = enum(u5) {
175175};
176176
177177test "Register.id" {
178 testing.expectEqual(@as(u4, 15), Register.r15.id());
179 testing.expectEqual(@as(u4, 15), Register.pc.id());
178 try testing.expectEqual(@as(u4, 15), Register.r15.id());
179 try testing.expectEqual(@as(u4, 15), Register.pc.id());
180180}
181181
182182/// Program status registers containing flags, mode bits and other
......@@ -1225,7 +1225,7 @@ test "serialize instructions" {
12251225
12261226 for (testcases) |case| {
12271227 const actual = case.inst.toU32();
1228 testing.expectEqual(case.expected, actual);
1228 try testing.expectEqual(case.expected, actual);
12291229 }
12301230}
12311231
......@@ -1265,6 +1265,6 @@ test "aliases" {
12651265 };
12661266
12671267 for (testcases) |case| {
1268 testing.expectEqual(case.expected.toU32(), case.actual.toU32());
1268 try testing.expectEqual(case.expected.toU32(), case.actual.toU32());
12691269 }
12701270}
src/codegen/riscv64.zig+1-1
......@@ -465,6 +465,6 @@ test "serialize instructions" {
465465
466466 for (testcases) |case| {
467467 const actual = case.inst.toU32();
468 testing.expectEqual(case.expected, actual);
468 try testing.expectEqual(case.expected, actual);
469469 }
470470}
src/codegen/wasm.zig+5-5
......@@ -463,11 +463,11 @@ test "Wasm - buildOpcode" {
463463 const i64_extend32_s = buildOpcode(.{ .op = .extend, .valtype1 = .i64, .width = 32, .signedness = .signed });
464464 const f64_reinterpret_i64 = buildOpcode(.{ .op = .reinterpret, .valtype1 = .f64, .valtype2 = .i64 });
465465
466 testing.expectEqual(@as(wasm.Opcode, .i32_const), i32_const);
467 testing.expectEqual(@as(wasm.Opcode, .end), end);
468 testing.expectEqual(@as(wasm.Opcode, .local_get), local_get);
469 testing.expectEqual(@as(wasm.Opcode, .i64_extend32_s), i64_extend32_s);
470 testing.expectEqual(@as(wasm.Opcode, .f64_reinterpret_i64), f64_reinterpret_i64);
466 try testing.expectEqual(@as(wasm.Opcode, .i32_const), i32_const);
467 try testing.expectEqual(@as(wasm.Opcode, .end), end);
468 try testing.expectEqual(@as(wasm.Opcode, .local_get), local_get);
469 try testing.expectEqual(@as(wasm.Opcode, .i64_extend32_s), i64_extend32_s);
470 try testing.expectEqual(@as(wasm.Opcode, .f64_reinterpret_i64), f64_reinterpret_i64);
471471}
472472
473473pub const Result = union(enum) {
src/link/MachO/CodeSignature.zig+1-1
......@@ -182,7 +182,7 @@ test "CodeSignature header" {
182182 try code_sig.writeHeader(stream.writer());
183183
184184 const expected = &[_]u8{ 0xfa, 0xde, 0x0c, 0xc0, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0 };
185 testing.expect(mem.eql(u8, expected, &buffer));
185 try testing.expect(mem.eql(u8, expected, &buffer));
186186}
187187
188188pub fn calcCodeSignaturePaddingSize(id: []const u8, file_size: u64, page_size: u16) u32 {
src/link/MachO/Trie.zig+26-26
......@@ -404,15 +404,15 @@ test "Trie node count" {
404404 var trie = Trie.init(gpa);
405405 defer trie.deinit();
406406
407 testing.expectEqual(trie.node_count, 0);
408 testing.expect(trie.root == null);
407 try testing.expectEqual(trie.node_count, 0);
408 try testing.expect(trie.root == null);
409409
410410 try trie.put(.{
411411 .name = "_main",
412412 .vmaddr_offset = 0,
413413 .export_flags = 0,
414414 });
415 testing.expectEqual(trie.node_count, 2);
415 try testing.expectEqual(trie.node_count, 2);
416416
417417 // Inserting the same node shouldn't update the trie.
418418 try trie.put(.{
......@@ -420,14 +420,14 @@ test "Trie node count" {
420420 .vmaddr_offset = 0,
421421 .export_flags = 0,
422422 });
423 testing.expectEqual(trie.node_count, 2);
423 try testing.expectEqual(trie.node_count, 2);
424424
425425 try trie.put(.{
426426 .name = "__mh_execute_header",
427427 .vmaddr_offset = 0x1000,
428428 .export_flags = 0,
429429 });
430 testing.expectEqual(trie.node_count, 4);
430 try testing.expectEqual(trie.node_count, 4);
431431
432432 // Inserting the same node shouldn't update the trie.
433433 try trie.put(.{
......@@ -435,13 +435,13 @@ test "Trie node count" {
435435 .vmaddr_offset = 0x1000,
436436 .export_flags = 0,
437437 });
438 testing.expectEqual(trie.node_count, 4);
438 try testing.expectEqual(trie.node_count, 4);
439439 try trie.put(.{
440440 .name = "_main",
441441 .vmaddr_offset = 0,
442442 .export_flags = 0,
443443 });
444 testing.expectEqual(trie.node_count, 4);
444 try testing.expectEqual(trie.node_count, 4);
445445}
446446
447447test "Trie basic" {
......@@ -455,8 +455,8 @@ test "Trie basic" {
455455 .vmaddr_offset = 0,
456456 .export_flags = 0,
457457 });
458 testing.expect(trie.root.?.edges.items.len == 1);
459 testing.expect(mem.eql(u8, trie.root.?.edges.items[0].label, "_st"));
458 try testing.expect(trie.root.?.edges.items.len == 1);
459 try testing.expect(mem.eql(u8, trie.root.?.edges.items[0].label, "_st"));
460460
461461 {
462462 // root --- _st ---> node --- art ---> node
......@@ -465,12 +465,12 @@ test "Trie basic" {
465465 .vmaddr_offset = 0,
466466 .export_flags = 0,
467467 });
468 testing.expect(trie.root.?.edges.items.len == 1);
468 try testing.expect(trie.root.?.edges.items.len == 1);
469469
470470 const nextEdge = &trie.root.?.edges.items[0];
471 testing.expect(mem.eql(u8, nextEdge.label, "_st"));
472 testing.expect(nextEdge.to.edges.items.len == 1);
473 testing.expect(mem.eql(u8, nextEdge.to.edges.items[0].label, "art"));
471 try testing.expect(mem.eql(u8, nextEdge.label, "_st"));
472 try testing.expect(nextEdge.to.edges.items.len == 1);
473 try testing.expect(mem.eql(u8, nextEdge.to.edges.items[0].label, "art"));
474474 }
475475 {
476476 // root --- _ ---> node --- st ---> node --- art ---> node
......@@ -481,16 +481,16 @@ test "Trie basic" {
481481 .vmaddr_offset = 0,
482482 .export_flags = 0,
483483 });
484 testing.expect(trie.root.?.edges.items.len == 1);
484 try testing.expect(trie.root.?.edges.items.len == 1);
485485
486486 const nextEdge = &trie.root.?.edges.items[0];
487 testing.expect(mem.eql(u8, nextEdge.label, "_"));
488 testing.expect(nextEdge.to.edges.items.len == 2);
489 testing.expect(mem.eql(u8, nextEdge.to.edges.items[0].label, "st"));
490 testing.expect(mem.eql(u8, nextEdge.to.edges.items[1].label, "main"));
487 try testing.expect(mem.eql(u8, nextEdge.label, "_"));
488 try testing.expect(nextEdge.to.edges.items.len == 2);
489 try testing.expect(mem.eql(u8, nextEdge.to.edges.items[0].label, "st"));
490 try testing.expect(mem.eql(u8, nextEdge.to.edges.items[1].label, "main"));
491491
492492 const nextNextEdge = &nextEdge.to.edges.items[0];
493 testing.expect(mem.eql(u8, nextNextEdge.to.edges.items[0].label, "art"));
493 try testing.expect(mem.eql(u8, nextNextEdge.to.edges.items[0].label, "art"));
494494 }
495495}
496496
......@@ -529,15 +529,15 @@ test "write Trie to a byte stream" {
529529 var stream = std.io.fixedBufferStream(buffer);
530530 {
531531 const nwritten = try trie.write(stream.writer());
532 testing.expect(nwritten == trie.size);
533 testing.expect(mem.eql(u8, buffer, &exp_buffer));
532 try testing.expect(nwritten == trie.size);
533 try testing.expect(mem.eql(u8, buffer, &exp_buffer));
534534 }
535535 {
536536 // Writing finalized trie again should yield the same result.
537537 try stream.seekTo(0);
538538 const nwritten = try trie.write(stream.writer());
539 testing.expect(nwritten == trie.size);
540 testing.expect(mem.eql(u8, buffer, &exp_buffer));
539 try testing.expect(nwritten == trie.size);
540 try testing.expect(mem.eql(u8, buffer, &exp_buffer));
541541 }
542542}
543543
......@@ -560,7 +560,7 @@ test "parse Trie from byte stream" {
560560 defer trie.deinit();
561561 const nread = try trie.read(in_stream.reader());
562562
563 testing.expect(nread == in_buffer.len);
563 try testing.expect(nread == in_buffer.len);
564564
565565 try trie.finalize();
566566
......@@ -569,6 +569,6 @@ test "parse Trie from byte stream" {
569569 var out_stream = std.io.fixedBufferStream(out_buffer);
570570 const nwritten = try trie.write(out_stream.writer());
571571
572 testing.expect(nwritten == trie.size);
573 testing.expect(mem.eql(u8, &in_buffer, out_buffer));
572 try testing.expect(nwritten == trie.size);
573 try testing.expect(mem.eql(u8, &in_buffer, out_buffer));
574574}
src/link/MachO/commands.zig+2-2
......@@ -286,13 +286,13 @@ fn testRead(allocator: *Allocator, buffer: []const u8, expected: anytype) !void
286286 var stream = io.fixedBufferStream(buffer);
287287 var given = try LoadCommand.read(allocator, stream.reader());
288288 defer given.deinit(allocator);
289 testing.expect(expected.eql(given));
289 try testing.expect(expected.eql(given));
290290}
291291
292292fn testWrite(buffer: []u8, cmd: LoadCommand, expected: []const u8) !void {
293293 var stream = io.fixedBufferStream(buffer);
294294 try cmd.write(stream.writer());
295 testing.expect(mem.eql(u8, expected, buffer[0..expected.len]));
295 try testing.expect(mem.eql(u8, expected, buffer[0..expected.len]));
296296}
297297
298298test "read-write segment command" {
src/register_manager.zig+24-24
......@@ -267,21 +267,21 @@ test "tryAllocReg: no spilling" {
267267 .src = .unneeded,
268268 };
269269
270 std.testing.expect(!function.register_manager.isRegAllocated(.r2));
271 std.testing.expect(!function.register_manager.isRegAllocated(.r3));
270 try std.testing.expect(!function.register_manager.isRegAllocated(.r2));
271 try std.testing.expect(!function.register_manager.isRegAllocated(.r3));
272272
273 std.testing.expectEqual(@as(?MockRegister, .r2), function.register_manager.tryAllocReg(&mock_instruction));
274 std.testing.expectEqual(@as(?MockRegister, .r3), function.register_manager.tryAllocReg(&mock_instruction));
275 std.testing.expectEqual(@as(?MockRegister, null), function.register_manager.tryAllocReg(&mock_instruction));
273 try std.testing.expectEqual(@as(?MockRegister, .r2), function.register_manager.tryAllocReg(&mock_instruction));
274 try std.testing.expectEqual(@as(?MockRegister, .r3), function.register_manager.tryAllocReg(&mock_instruction));
275 try std.testing.expectEqual(@as(?MockRegister, null), function.register_manager.tryAllocReg(&mock_instruction));
276276
277 std.testing.expect(function.register_manager.isRegAllocated(.r2));
278 std.testing.expect(function.register_manager.isRegAllocated(.r3));
277 try std.testing.expect(function.register_manager.isRegAllocated(.r2));
278 try std.testing.expect(function.register_manager.isRegAllocated(.r3));
279279
280280 function.register_manager.freeReg(.r2);
281281 function.register_manager.freeReg(.r3);
282282
283 std.testing.expect(function.register_manager.isRegAllocated(.r2));
284 std.testing.expect(function.register_manager.isRegAllocated(.r3));
283 try std.testing.expect(function.register_manager.isRegAllocated(.r2));
284 try std.testing.expect(function.register_manager.isRegAllocated(.r3));
285285}
286286
287287test "allocReg: spilling" {
......@@ -298,20 +298,20 @@ test "allocReg: spilling" {
298298 .src = .unneeded,
299299 };
300300
301 std.testing.expect(!function.register_manager.isRegAllocated(.r2));
302 std.testing.expect(!function.register_manager.isRegAllocated(.r3));
301 try std.testing.expect(!function.register_manager.isRegAllocated(.r2));
302 try std.testing.expect(!function.register_manager.isRegAllocated(.r3));
303303
304 std.testing.expectEqual(@as(?MockRegister, .r2), try function.register_manager.allocReg(&mock_instruction));
305 std.testing.expectEqual(@as(?MockRegister, .r3), try function.register_manager.allocReg(&mock_instruction));
304 try std.testing.expectEqual(@as(?MockRegister, .r2), try function.register_manager.allocReg(&mock_instruction));
305 try std.testing.expectEqual(@as(?MockRegister, .r3), try function.register_manager.allocReg(&mock_instruction));
306306
307307 // Spill a register
308 std.testing.expectEqual(@as(?MockRegister, .r2), try function.register_manager.allocReg(&mock_instruction));
309 std.testing.expectEqualSlices(MockRegister, &[_]MockRegister{.r2}, function.spilled.items);
308 try std.testing.expectEqual(@as(?MockRegister, .r2), try function.register_manager.allocReg(&mock_instruction));
309 try std.testing.expectEqualSlices(MockRegister, &[_]MockRegister{.r2}, function.spilled.items);
310310
311311 // No spilling necessary
312312 function.register_manager.freeReg(.r3);
313 std.testing.expectEqual(@as(?MockRegister, .r3), try function.register_manager.allocReg(&mock_instruction));
314 std.testing.expectEqualSlices(MockRegister, &[_]MockRegister{.r2}, function.spilled.items);
313 try std.testing.expectEqual(@as(?MockRegister, .r3), try function.register_manager.allocReg(&mock_instruction));
314 try std.testing.expectEqualSlices(MockRegister, &[_]MockRegister{.r2}, function.spilled.items);
315315}
316316
317317test "getReg" {
......@@ -328,18 +328,18 @@ test "getReg" {
328328 .src = .unneeded,
329329 };
330330
331 std.testing.expect(!function.register_manager.isRegAllocated(.r2));
332 std.testing.expect(!function.register_manager.isRegAllocated(.r3));
331 try std.testing.expect(!function.register_manager.isRegAllocated(.r2));
332 try std.testing.expect(!function.register_manager.isRegAllocated(.r3));
333333
334334 try function.register_manager.getReg(.r3, &mock_instruction);
335335
336 std.testing.expect(!function.register_manager.isRegAllocated(.r2));
337 std.testing.expect(function.register_manager.isRegAllocated(.r3));
336 try std.testing.expect(!function.register_manager.isRegAllocated(.r2));
337 try std.testing.expect(function.register_manager.isRegAllocated(.r3));
338338
339339 // Spill r3
340340 try function.register_manager.getReg(.r3, &mock_instruction);
341341
342 std.testing.expect(!function.register_manager.isRegAllocated(.r2));
343 std.testing.expect(function.register_manager.isRegAllocated(.r3));
344 std.testing.expectEqualSlices(MockRegister, &[_]MockRegister{.r3}, function.spilled.items);
342 try std.testing.expect(!function.register_manager.isRegAllocated(.r2));
343 try std.testing.expect(function.register_manager.isRegAllocated(.r3));
344 try std.testing.expectEqualSlices(MockRegister, &[_]MockRegister{.r3}, function.spilled.items);
345345}
src/test.zig+3-3
......@@ -705,14 +705,14 @@ pub const TestContext = struct {
705705 defer file.close();
706706 const out = try file.reader().readAllAlloc(arena, 5 * 1024 * 1024);
707707
708 std.testing.expectEqualStrings(expected_output, out);
708 try std.testing.expectEqualStrings(expected_output, out);
709709 },
710710 .CompareObjectFile => |expected_output| {
711711 var file = try tmp.dir.openFile(bin_name, .{ .read = true });
712712 defer file.close();
713713 const out = try file.reader().readAllAlloc(arena, 5 * 1024 * 1024);
714714
715 std.testing.expectEqualStrings(expected_output, out);
715 try std.testing.expectEqualStrings(expected_output, out);
716716 },
717717 .Error => |case_error_list| {
718718 var test_node = update_node.start("assert", 0);
......@@ -939,7 +939,7 @@ pub const TestContext = struct {
939939 return error.ZigTestFailed;
940940 },
941941 }
942 std.testing.expectEqualStrings(expected_stdout, exec_result.stdout);
942 try std.testing.expectEqualStrings(expected_stdout, exec_result.stdout);
943943 // We allow stderr to have garbage in it because wasmtime prints a
944944 // warning about --invoke even though we don't pass it.
945945 //std.testing.expectEqualStrings("", exec_result.stderr);
src/value.zig+3-3
......@@ -1456,19 +1456,19 @@ test "hash same value different representation" {
14561456 .data = 0,
14571457 };
14581458 const zero_2 = Value.initPayload(&payload_1.base);
1459 std.testing.expectEqual(zero_1.hash(), zero_2.hash());
1459 try std.testing.expectEqual(zero_1.hash(), zero_2.hash());
14601460
14611461 var payload_2 = Value.Payload.I64{
14621462 .base = .{ .tag = .int_i64 },
14631463 .data = 0,
14641464 };
14651465 const zero_3 = Value.initPayload(&payload_2.base);
1466 std.testing.expectEqual(zero_2.hash(), zero_3.hash());
1466 try std.testing.expectEqual(zero_2.hash(), zero_3.hash());
14671467
14681468 var payload_3 = Value.Payload.BigInt{
14691469 .base = .{ .tag = .int_big_negative },
14701470 .data = &[_]std.math.big.Limb{0},
14711471 };
14721472 const zero_4 = Value.initPayload(&payload_3.base);
1473 std.testing.expectEqual(zero_3.hash(), zero_4.hash());
1473 try std.testing.expectEqual(zero_3.hash(), zero_4.hash());
14741474}