std.testing: fix a crash when printing diffs

This commit is contained in:
Andrew Kelley 2020-05-22 00:27:51 -04:00
parent 8252c8b9d6
commit 1dac9e71b5

View File

@ -320,10 +320,11 @@ fn printWithVisibleNewlines(source: []const u8) void {
}
fn printLine(line: []const u8) void {
switch (line[line.len - 1]) {
if (line.len != 0) switch (line[line.len - 1]) {
' ', '\t' => warn("{}⏎\n", .{line}), // Carriage return symbol,
else => warn("{}\n", .{line}),
}
else => {},
};
warn("{}\n", .{line});
}
test "" {