aboutsummaryrefslogtreecommitdiff
path: root/lib/std/testing.zig
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/testing.zig')
-rw-r--r--lib/std/testing.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/testing.zig b/lib/std/testing.zig
index 7cef6f9c58..b99542e7e5 100644
--- a/lib/std/testing.zig
+++ b/lib/std/testing.zig
@@ -355,7 +355,7 @@ test expectApproxEqRel {
/// This function is intended to be used only in tests. When the two slices are not
/// equal, prints diagnostics to stderr to show exactly how they are not equal (with
/// the differences highlighted in red), then returns a test failure error.
-/// The colorized output is optional and controlled by the return of `std.Io.tty.detectConfig()`.
+/// The colorized output is optional and controlled by the return of `std.Io.tty.Config.detect`.
/// If your inputs are UTF-8 encoded strings, consider calling `expectEqualStrings` instead.
pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const T) !void {
const diff_index: usize = diff_index: {
@@ -367,9 +367,9 @@ pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const
break :diff_index if (expected.len == actual.len) return else shortest;
};
if (!backend_can_print) return error.TestExpectedEqual;
- const stderr_w = std.debug.lockStderrWriter(&.{});
+ const stderr_w, const ttyconf = std.debug.lockStderrWriter(&.{});
defer std.debug.unlockStderrWriter();
- failEqualSlices(T, expected, actual, diff_index, stderr_w) catch {};
+ failEqualSlices(T, expected, actual, diff_index, stderr_w, ttyconf) catch {};
return error.TestExpectedEqual;
}
@@ -379,6 +379,7 @@ fn failEqualSlices(
actual: []const T,
diff_index: usize,
w: *std.Io.Writer,
+ ttyconf: std.Io.tty.Config,
) !void {
try w.print("slices differ. first difference occurs at index {d} (0x{X})\n", .{ diff_index, diff_index });
@@ -398,7 +399,6 @@ fn failEqualSlices(
const actual_window = actual[window_start..@min(actual.len, window_start + max_window_size)];
const actual_truncated = window_start + actual_window.len < actual.len;
- const ttyconf = std.Io.tty.detectConfig(.stderr());
var differ = if (T == u8) BytesDiffer{
.expected = expected_window,
.actual = actual_window,