authorgravatar for 54070204+0x5a4@users.noreply.github.com0x5a4 <54070204+0x5a4@users.noreply.github.com> 2023-05-06 21:28:08+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-10 00:43:45-07:00
log11fabc4cbee7addbdb86d6ba0297abe8274bbbb4
treec72e7332f1abbad22c0ae6fe74e4553c39619a74
parent52606572309f843c043123c1f2771829e45b4b5d

fix 'zig build test' crashing with no tests

fixes #15553

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

lib/std/Build/Step/Run.zig+1-1
...@@ -822,7 +822,7 @@ fn runCommand(...@@ -822,7 +822,7 @@ fn runCommand(
822 .zig_test => {822 .zig_test => {
823 const prefix: []const u8 = p: {823 const prefix: []const u8 = p: {
824 if (result.stdio.test_metadata) |tm| {824 if (result.stdio.test_metadata) |tm| {
825 if (tm.next_index <= tm.names.len) {825 if (tm.next_index > 0 and tm.next_index <= tm.names.len) {
826 const name = tm.testName(tm.next_index - 1);826 const name = tm.testName(tm.next_index - 1);
827 break :p b.fmt("while executing test '{s}', ", .{name});827 break :p b.fmt("while executing test '{s}', ", .{name});
828 }828 }