authorgravatar for topolarity@tapscott.meCody Tapscott <topolarity@tapscott.me> 2022-04-12 10:54:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-04-13 01:09:21-04:00
logaaac8eae683172546ce9e018d8c419f62793f8d4
treeb3e2a0a759d7666b143177bd87ca0b7dd6c20b77
parent8ada446b1f69842793321978b4ae796a550d99a9

Use 0-indexing for incremental compile error tests


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

src/test.zig+9-9
......@@ -656,10 +656,10 @@ pub const TestContext = struct {
656656
657657 const Strategy = enum {
658658 /// Execute tests as independent compilations, unless they are explicitly
659 /// incremental ("foo.1.zig", "foo.2.zig", etc.)
659 /// incremental ("foo.0.zig", "foo.1.zig", etc.)
660660 independent,
661661 /// Execute all tests as incremental updates to a single compilation. Explicitly
662 /// incremental tests ("foo.1.zig", "foo.2.zig", etc.) still execute in order
662 /// incremental tests ("foo.0.zig", "foo.1.zig", etc.) still execute in order
663663 incremental,
664664 };
665665
......@@ -716,8 +716,8 @@ pub const TestContext = struct {
716716 };
717717 }
718718
719 /// Sort test filenames in-place, so that incremental test cases ("foo.1.zig",
720 /// "foo.2.zig", etc.) are contiguous and appear in numerical order.
719 /// Sort test filenames in-place, so that incremental test cases ("foo.0.zig",
720 /// "foo.1.zig", etc.) are contiguous and appear in numerical order.
721721 fn sortTestFilenames(
722722 filenames: [][]const u8,
723723 ) void {
......@@ -804,8 +804,8 @@ pub const TestContext = struct {
804804 } else {
805805
806806 // This is not the same test sequence, so the new file must be the first file
807 // in a new sequence ("*.1.zig") or an independent test file ("*.zig")
808 if (new_parts.test_index != null and new_parts.test_index.? != 1) return error.InvalidIncrementalTestIndex;
807 // in a new sequence ("*.0.zig") or an independent test file ("*.zig")
808 if (new_parts.test_index != null and new_parts.test_index.? != 0) return error.InvalidIncrementalTestIndex;
809809
810810 if (strategy == .independent)
811811 opt_case = null; // Generate a new independent test case for this update
......@@ -1239,7 +1239,7 @@ pub const TestContext = struct {
12391239 if (all_errors.list.len != 0) {
12401240 print(
12411241 "\nCase '{s}': unexpected errors at update_index={d}:\n{s}\n",
1242 .{ case.name, update_index + 1, hr },
1242 .{ case.name, update_index, hr },
12431243 );
12441244 for (all_errors.list) |err_msg| {
12451245 switch (err_msg) {
......@@ -1401,7 +1401,7 @@ pub const TestContext = struct {
14011401 }
14021402
14031403 if (any_failed) {
1404 print("\nupdate_index={d}\n", .{update_index + 1});
1404 print("\nupdate_index={d}\n", .{update_index});
14051405 return error.WrongCompileErrors;
14061406 }
14071407 },
......@@ -1508,7 +1508,7 @@ pub const TestContext = struct {
15081508 .cwd = tmp_dir_path,
15091509 }) catch |err| {
15101510 print("\nupdate_index={d} The following command failed with {s}:\n", .{
1511 update_index + 1, @errorName(err),
1511 update_index, @errorName(err),
15121512 });
15131513 dumpArgs(argv.items);
15141514 return error.ChildProcessExecution;