Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/std/testing.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down