diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-12-14 00:42:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-14 00:42:31 +0200 |
| commit | 65270cdc3345e9840427179168a09ef6e4dd34b9 (patch) | |
| tree | 3d4cd45795caaae02817d6642b1a373b07150b55 /lib/std/testing.zig | |
| parent | 9be5323e93123a3979037997fa40a95b4c985b85 (diff) | |
| parent | 7561f63b5d93fb32b39410590625bb16bf2ac0dd (diff) | |
| download | zig-65270cdc3345e9840427179168a09ef6e4dd34b9.tar.gz zig-65270cdc3345e9840427179168a09ef6e4dd34b9.zip | |
Merge pull request #12298 from r00ster91/debugerror
std.debug: handle some possible errors and resolve low-hanging TODOs
Diffstat (limited to 'lib/std/testing.zig')
| -rw-r--r-- | lib/std/testing.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 3bb3d6e14b..6a75999f71 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -387,9 +387,9 @@ fn SliceDiffer(comptime T: type) type { for (self.expected) |value, i| { var full_index = self.start_index + i; const diff = if (i < self.actual.len) !std.meta.eql(self.actual[i], value) else true; - if (diff) self.ttyconf.setColor(writer, .Red); + if (diff) try self.ttyconf.setColor(writer, .Red); try writer.print("[{}]: {any}\n", .{ full_index, value }); - if (diff) self.ttyconf.setColor(writer, .Reset); + if (diff) try self.ttyconf.setColor(writer, .Reset); } } }; @@ -427,9 +427,9 @@ const BytesDiffer = struct { } fn writeByteDiff(self: BytesDiffer, writer: anytype, comptime fmt: []const u8, byte: u8, diff: bool) !void { - if (diff) self.ttyconf.setColor(writer, .Red); + if (diff) try self.ttyconf.setColor(writer, .Red); try writer.print(fmt, .{byte}); - if (diff) self.ttyconf.setColor(writer, .Reset); + if (diff) try self.ttyconf.setColor(writer, .Reset); } const ChunkIterator = struct { |
