Commit 11fabc4cbe

0x5a4 <54070204+0x5a4@users.noreply.github.com>
2023-05-06 21:28:08
fix 'zig build test' crashing with no tests
fixes #15553
1 parent 5260657
Changed files (1)
lib
std
Build
Step
lib/std/Build/Step/Run.zig
@@ -822,7 +822,7 @@ fn runCommand(
         .zig_test => {
             const prefix: []const u8 = p: {
                 if (result.stdio.test_metadata) |tm| {
-                    if (tm.next_index <= tm.names.len) {
+                    if (tm.next_index > 0 and tm.next_index <= tm.names.len) {
                         const name = tm.testName(tm.next_index - 1);
                         break :p b.fmt("while executing test '{s}', ", .{name});
                     }