From 0b587b157418c51c23456b92cdeb560d799a2d51 Mon Sep 17 00:00:00 2001 From: Julian Wagner Date: Wed, 5 Nov 2025 18:18:57 +0100 Subject: [PATCH 1/3] Adding comment to testing.expectEqualStrings --- lib/std/testing.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/std/testing.zig b/lib/std/testing.zig index b99542e7e57b..fb4dd6979864 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -642,6 +642,9 @@ pub fn tmpDir(opts: std.fs.Dir.OpenOptions) TmpDir { }; } +/// This functions is to be used only in tests. When the two strings are not +/// equal, prints diagnostics to stderr to show exactly they are not equal, +/// then returns a test expected equal error. pub fn expectEqualStrings(expected: []const u8, actual: []const u8) !void { if (std.mem.indexOfDiff(u8, actual, expected)) |diff_index| { if (@inComptime()) { From 7c056c66a8ddde48e9d3c3a16c20cd0968683e80 Mon Sep 17 00:00:00 2001 From: "Julian M. Wagner" Date: Wed, 12 Nov 2025 16:23:13 +0100 Subject: [PATCH 2/3] Update testing.zig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Андрей Краевский <75577902+AndrewKraevskii@users.noreply.github.com> --- lib/std/testing.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/testing.zig b/lib/std/testing.zig index fb4dd6979864..98400a5611d1 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -643,7 +643,7 @@ pub fn tmpDir(opts: std.fs.Dir.OpenOptions) TmpDir { } /// This functions is to be used only in tests. When the two strings are not -/// equal, prints diagnostics to stderr to show exactly they are not equal, +/// equal, prints diagnostics to stderr to show exactly how they are not equal, /// then returns a test expected equal error. pub fn expectEqualStrings(expected: []const u8, actual: []const u8) !void { if (std.mem.indexOfDiff(u8, actual, expected)) |diff_index| { From a4ffc852777610cd4a8bb8522320eb0681332296 Mon Sep 17 00:00:00 2001 From: "Julian M. Wagner" Date: Wed, 12 Nov 2025 16:23:19 +0100 Subject: [PATCH 3/3] Update testing.zig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Андрей Краевский <75577902+AndrewKraevskii@users.noreply.github.com> --- lib/std/testing.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 98400a5611d1..bc718ada403f 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -644,7 +644,7 @@ pub fn tmpDir(opts: std.fs.Dir.OpenOptions) TmpDir { /// This functions is to be used only in tests. When the two strings are not /// equal, prints diagnostics to stderr to show exactly how they are not equal, -/// then returns a test expected equal error. +/// then returns a `error.TestExpectedEqual`. pub fn expectEqualStrings(expected: []const u8, actual: []const u8) !void { if (std.mem.indexOfDiff(u8, actual, expected)) |diff_index| { if (@inComptime()) {