| ... | @@ -695,7 +695,7 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -695,7 +695,7 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 695 | // Test `zig init-lib`. | 695 | // Test `zig init-lib`. |
| 696 | const tmp_path = b.makeTempPath(); | 696 | const tmp_path = b.makeTempPath(); |
| 697 | const init_lib = b.addSystemCommand(&.{ b.zig_exe, "init-lib" }); | 697 | const init_lib = b.addSystemCommand(&.{ b.zig_exe, "init-lib" }); |
| 698 | init_lib.cwd = tmp_path; | 698 | init_lib.setCwd(.{ .cwd_relative = tmp_path }); |
| 699 | init_lib.setName("zig init-lib"); | 699 | init_lib.setName("zig init-lib"); |
| 700 | init_lib.expectStdOutEqual(""); | 700 | init_lib.expectStdOutEqual(""); |
| 701 | init_lib.expectStdErrEqual("info: Created build.zig\n" ++ | 701 | init_lib.expectStdErrEqual("info: Created build.zig\n" ++ |
| ... | @@ -703,7 +703,7 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -703,7 +703,7 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 703 | "info: Next, try `zig build --help` or `zig build test`\n"); | 703 | "info: Next, try `zig build --help` or `zig build test`\n"); |
| 704 | | 704 | |
| 705 | const run_test = b.addSystemCommand(&.{ b.zig_exe, "build", "test" }); | 705 | const run_test = b.addSystemCommand(&.{ b.zig_exe, "build", "test" }); |
| 706 | run_test.cwd = tmp_path; | 706 | run_test.setCwd(.{ .cwd_relative = tmp_path }); |
| 707 | run_test.setName("zig build test"); | 707 | run_test.setName("zig build test"); |
| 708 | run_test.expectStdOutEqual(""); | 708 | run_test.expectStdOutEqual(""); |
| 709 | run_test.step.dependOn(&init_lib.step); | 709 | run_test.step.dependOn(&init_lib.step); |
| ... | @@ -718,7 +718,7 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -718,7 +718,7 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 718 | // Test `zig init-exe`. | 718 | // Test `zig init-exe`. |
| 719 | const tmp_path = b.makeTempPath(); | 719 | const tmp_path = b.makeTempPath(); |
| 720 | const init_exe = b.addSystemCommand(&.{ b.zig_exe, "init-exe" }); | 720 | const init_exe = b.addSystemCommand(&.{ b.zig_exe, "init-exe" }); |
| 721 | init_exe.cwd = tmp_path; | 721 | init_exe.setCwd(.{ .cwd_relative = tmp_path }); |
| 722 | init_exe.setName("zig init-exe"); | 722 | init_exe.setName("zig init-exe"); |
| 723 | init_exe.expectStdOutEqual(""); | 723 | init_exe.expectStdOutEqual(""); |
| 724 | init_exe.expectStdErrEqual("info: Created build.zig\n" ++ | 724 | init_exe.expectStdErrEqual("info: Created build.zig\n" ++ |
| ... | @@ -737,13 +737,13 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -737,13 +737,13 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 737 | run_bad.step.dependOn(&init_exe.step); | 737 | run_bad.step.dependOn(&init_exe.step); |
| 738 | | 738 | |
| 739 | const run_test = b.addSystemCommand(&.{ b.zig_exe, "build", "test" }); | 739 | const run_test = b.addSystemCommand(&.{ b.zig_exe, "build", "test" }); |
| 740 | run_test.cwd = tmp_path; | 740 | run_test.setCwd(.{ .cwd_relative = tmp_path }); |
| 741 | run_test.setName("zig build test"); | 741 | run_test.setName("zig build test"); |
| 742 | run_test.expectStdOutEqual(""); | 742 | run_test.expectStdOutEqual(""); |
| 743 | run_test.step.dependOn(&init_exe.step); | 743 | run_test.step.dependOn(&init_exe.step); |
| 744 | | 744 | |
| 745 | const run_run = b.addSystemCommand(&.{ b.zig_exe, "build", "run" }); | 745 | const run_run = b.addSystemCommand(&.{ b.zig_exe, "build", "run" }); |
| 746 | run_run.cwd = tmp_path; | 746 | run_run.setCwd(.{ .cwd_relative = tmp_path }); |
| 747 | run_run.setName("zig build run"); | 747 | run_run.setName("zig build run"); |
| 748 | run_run.expectStdOutEqual("Run `zig build test` to run the tests.\n"); | 748 | run_run.expectStdOutEqual("Run `zig build test` to run the tests.\n"); |
| 749 | run_run.expectStdErrEqual("All your codebase are belong to us.\n"); | 749 | run_run.expectStdErrEqual("All your codebase are belong to us.\n"); |
| ... | @@ -821,7 +821,7 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -821,7 +821,7 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 821 | // Test zig fmt affecting only the appropriate files. | 821 | // Test zig fmt affecting only the appropriate files. |
| 822 | const run1 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "fmt1.zig" }); | 822 | const run1 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "fmt1.zig" }); |
| 823 | run1.setName("run zig fmt one file"); | 823 | run1.setName("run zig fmt one file"); |
| 824 | run1.cwd = tmp_path; | 824 | run1.setCwd(.{ .cwd_relative = tmp_path }); |
| 825 | run1.has_side_effects = true; | 825 | run1.has_side_effects = true; |
| 826 | // stdout should be file path + \n | 826 | // stdout should be file path + \n |
| 827 | run1.expectStdOutEqual("fmt1.zig\n"); | 827 | run1.expectStdOutEqual("fmt1.zig\n"); |
| ... | @@ -829,7 +829,7 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -829,7 +829,7 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 829 | // Test excluding files and directories from a run | 829 | // Test excluding files and directories from a run |
| 830 | const run2 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "--exclude", "fmt2.zig", "--exclude", "subdir", "." }); | 830 | const run2 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "--exclude", "fmt2.zig", "--exclude", "subdir", "." }); |
| 831 | run2.setName("run zig fmt on directory with exclusions"); | 831 | run2.setName("run zig fmt on directory with exclusions"); |
| 832 | run2.cwd = tmp_path; | 832 | run2.setCwd(.{ .cwd_relative = tmp_path }); |
| 833 | run2.has_side_effects = true; | 833 | run2.has_side_effects = true; |
| 834 | run2.expectStdOutEqual(""); | 834 | run2.expectStdOutEqual(""); |
| 835 | run2.step.dependOn(&run1.step); | 835 | run2.step.dependOn(&run1.step); |
| ... | @@ -837,7 +837,7 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -837,7 +837,7 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 837 | // Test excluding non-existent file | 837 | // Test excluding non-existent file |
| 838 | const run3 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "--exclude", "fmt2.zig", "--exclude", "nonexistent.zig", "." }); | 838 | const run3 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "--exclude", "fmt2.zig", "--exclude", "nonexistent.zig", "." }); |
| 839 | run3.setName("run zig fmt on directory with non-existent exclusion"); | 839 | run3.setName("run zig fmt on directory with non-existent exclusion"); |
| 840 | run3.cwd = tmp_path; | 840 | run3.setCwd(.{ .cwd_relative = tmp_path }); |
| 841 | run3.has_side_effects = true; | 841 | run3.has_side_effects = true; |
| 842 | run3.expectStdOutEqual("." ++ s ++ "subdir" ++ s ++ "fmt3.zig\n"); | 842 | run3.expectStdOutEqual("." ++ s ++ "subdir" ++ s ++ "fmt3.zig\n"); |
| 843 | run3.step.dependOn(&run2.step); | 843 | run3.step.dependOn(&run2.step); |
| ... | @@ -845,7 +845,7 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -845,7 +845,7 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 845 | // running it on the dir, only the new file should be changed | 845 | // running it on the dir, only the new file should be changed |
| 846 | const run4 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "." }); | 846 | const run4 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "." }); |
| 847 | run4.setName("run zig fmt the directory"); | 847 | run4.setName("run zig fmt the directory"); |
| 848 | run4.cwd = tmp_path; | 848 | run4.setCwd(.{ .cwd_relative = tmp_path }); |
| 849 | run4.has_side_effects = true; | 849 | run4.has_side_effects = true; |
| 850 | run4.expectStdOutEqual("." ++ s ++ "fmt2.zig\n"); | 850 | run4.expectStdOutEqual("." ++ s ++ "fmt2.zig\n"); |
| 851 | run4.step.dependOn(&run3.step); | 851 | run4.step.dependOn(&run3.step); |
| ... | @@ -853,7 +853,7 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -853,7 +853,7 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 853 | // both files have been formatted, nothing should change now | 853 | // both files have been formatted, nothing should change now |
| 854 | const run5 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "." }); | 854 | const run5 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "." }); |
| 855 | run5.setName("run zig fmt with nothing to do"); | 855 | run5.setName("run zig fmt with nothing to do"); |
| 856 | run5.cwd = tmp_path; | 856 | run5.setCwd(.{ .cwd_relative = tmp_path }); |
| 857 | run5.has_side_effects = true; | 857 | run5.has_side_effects = true; |
| 858 | run5.expectStdOutEqual(""); | 858 | run5.expectStdOutEqual(""); |
| 859 | run5.step.dependOn(&run4.step); | 859 | run5.step.dependOn(&run4.step); |
| ... | @@ -867,7 +867,7 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -867,7 +867,7 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 867 | // Test `zig fmt` handling UTF-16 decoding. | 867 | // Test `zig fmt` handling UTF-16 decoding. |
| 868 | const run6 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "." }); | 868 | const run6 = b.addSystemCommand(&.{ b.zig_exe, "fmt", "." }); |
| 869 | run6.setName("run zig fmt convert UTF-16 to UTF-8"); | 869 | run6.setName("run zig fmt convert UTF-16 to UTF-8"); |
| 870 | run6.cwd = tmp_path; | 870 | run6.setCwd(.{ .cwd_relative = tmp_path }); |
| 871 | run6.has_side_effects = true; | 871 | run6.has_side_effects = true; |
| 872 | run6.expectStdOutEqual("." ++ s ++ "fmt6.zig\n"); | 872 | run6.expectStdOutEqual("." ++ s ++ "fmt6.zig\n"); |
| 873 | run6.step.dependOn(&write6.step); | 873 | run6.step.dependOn(&write6.step); |