This commit is contained in:
Julian M. Wagner 2025-11-23 22:56:45 +00:00 committed by GitHub
commit 4caa21c176
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 how they are not equal,
/// 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()) {