| ... | ... | @@ -490,9 +490,7 @@ fn getTestFileNameParts(name: []const u8) struct { |
| 490 | 490 | |
| 491 | 491 | /// Sort test filenames in-place, so that incremental test cases ("foo.0.zig", |
| 492 | 492 | /// "foo.1.zig", etc.) are contiguous and appear in numerical order. |
| 493 | | fn sortTestFilenames( |
| 494 | | filenames: [][]const u8, |
| 495 | | ) void { |
| 493 | fn sortTestFilenames(filenames: [][]const u8) void { |
| 496 | 494 | const Context = struct { |
| 497 | 495 | pub fn lessThan(_: @This(), a: []const u8, b: []const u8) bool { |
| 498 | 496 | const a_parts = getTestFileNameParts(a); |
| ... | ... | @@ -505,14 +503,20 @@ fn sortTestFilenames( |
| 505 | 503 | .eq => switch (std.mem.order(u8, a_parts.file_ext, b_parts.file_ext)) { |
| 506 | 504 | .lt => true, |
| 507 | 505 | .gt => false, |
| 508 | | .eq => b: { // a and b differ only in their ".X" part |
| 506 | .eq => { |
| 507 | // a and b differ only in their ".X" part |
| 509 | 508 | |
| 510 | 509 | // Sort "<base_name>.<file_ext>" before any "<base_name>.X.<file_ext>" |
| 511 | | if (a_parts.test_index == null) break :b true; |
| 512 | | if (b_parts.test_index == null) break :b false; |
| 513 | | |
| 514 | | // Make sure that incremental tests appear in linear order |
| 515 | | return a_parts.test_index.? < b_parts.test_index.?; |
| 510 | if (a_parts.test_index) |a_index| { |
| 511 | if (b_parts.test_index) |b_index| { |
| 512 | // Make sure that incremental tests appear in linear order |
| 513 | return a_index < b_index; |
| 514 | } else { |
| 515 | return false; |
| 516 | } |
| 517 | } else { |
| 518 | return b_parts.test_index != null; |
| 519 | } |
| 516 | 520 | }, |
| 517 | 521 | }, |
| 518 | 522 | }; |