authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-07-25 14:51:22+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-07-25 15:51:22+03:00
log8f3ab96b0e8cd22dc98f9fe352c5d4fff491dd0e
tree682b03f93533e74488878694b8240c815e4be403
parent0d120fcb892d99417ee361adb79671c473f798ee
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

std.testing: make the caret indicator line more helpful


1 files changed, 4 insertions(+), 1 deletions(-)

lib/std/testing.zig+4-1
...@@ -543,7 +543,10 @@ fn printIndicatorLine(source: []const u8, indicator_index: usize) void {...@@ -543,7 +543,10 @@ fn printIndicatorLine(source: []const u8, indicator_index: usize) void {
543 while (i < indicator_index) : (i += 1)543 while (i < indicator_index) : (i += 1)
544 print(" ", .{});544 print(" ", .{});
545 }545 }
546 print("^\n", .{});546 if (indicator_index >= source.len)
547 print("^ (end of string)\n", .{})
548 else
549 print("^ ('\\x{x:0>2}')\n", .{source[indicator_index]});
547}550}
548551
549fn printWithVisibleNewlines(source: []const u8) void {552fn printWithVisibleNewlines(source: []const u8) void {