| ... | @@ -660,20 +660,19 @@ pub fn addLinkTests( | ... | @@ -660,20 +660,19 @@ pub fn addLinkTests( |
| 660 | | 660 | |
| 661 | pub fn addCliTests(b: *std.Build) *Step { | 661 | pub fn addCliTests(b: *std.Build) *Step { |
| 662 | const step = b.step("test-cli", "Test the command line interface"); | 662 | const step = b.step("test-cli", "Test the command line interface"); |
| | 663 | const s = std.fs.path.sep_str; |
| 663 | | 664 | |
| 664 | { | 665 | { |
| | 666 | |
| 665 | // Test `zig init-lib`. | 667 | // Test `zig init-lib`. |
| 666 | const tmp_path = b.makeTempPath(); | 668 | const tmp_path = b.makeTempPath(); |
| 667 | const init_lib = b.addSystemCommand(&.{ b.zig_exe, "init-lib" }); | 669 | const init_lib = b.addSystemCommand(&.{ b.zig_exe, "init-lib" }); |
| 668 | init_lib.cwd = tmp_path; | 670 | init_lib.cwd = tmp_path; |
| 669 | init_lib.setName("zig init-lib"); | 671 | init_lib.setName("zig init-lib"); |
| 670 | init_lib.expectStdOutEqual(""); | 672 | init_lib.expectStdOutEqual(""); |
| 671 | init_lib.expectStdErrEqual( | 673 | init_lib.expectStdErrEqual("info: Created build.zig\n" ++ |
| 672 | \\info: Created build.zig | 674 | "info: Created src" ++ s ++ "main.zig\n" ++ |
| 673 | \\info: Created src/main.zig | 675 | "info: Next, try `zig build --help` or `zig build test`\n"); |
| 674 | \\info: Next, try `zig build --help` or `zig build test` | | |
| 675 | \\ | | |
| 676 | ); | | |
| 677 | | 676 | |
| 678 | const run_test = b.addSystemCommand(&.{ b.zig_exe, "build", "test" }); | 677 | const run_test = b.addSystemCommand(&.{ b.zig_exe, "build", "test" }); |
| 679 | run_test.cwd = tmp_path; | 678 | run_test.cwd = tmp_path; |
| ... | @@ -694,15 +693,11 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -694,15 +693,11 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 694 | init_exe.cwd = tmp_path; | 693 | init_exe.cwd = tmp_path; |
| 695 | init_exe.setName("zig init-exe"); | 694 | init_exe.setName("zig init-exe"); |
| 696 | init_exe.expectStdOutEqual(""); | 695 | init_exe.expectStdOutEqual(""); |
| 697 | init_exe.expectStdErrEqual( | 696 | init_exe.expectStdErrEqual("info: Created build.zig\n" ++ |
| 698 | \\info: Created build.zig | 697 | "info: Created src" ++ s ++ "main.zig\n" ++ |
| 699 | \\info: Created src/main.zig | 698 | "info: Next, try `zig build --help` or `zig build run`\n"); |
| 700 | \\info: Next, try `zig build --help` or `zig build run` | | |
| 701 | \\ | | |
| 702 | ); | | |
| 703 | | 699 | |
| 704 | // Test missing output path. | 700 | // Test missing output path. |
| 705 | const s = std.fs.path.sep_str; | | |
| 706 | const bad_out_arg = "-femit-bin=does" ++ s ++ "not" ++ s ++ "exist" ++ s ++ "foo.exe"; | 701 | const bad_out_arg = "-femit-bin=does" ++ s ++ "not" ++ s ++ "exist" ++ s ++ "foo.exe"; |
| 707 | const ok_src_arg = "src" ++ s ++ "main.zig"; | 702 | const ok_src_arg = "src" ++ s ++ "main.zig"; |
| 708 | const expected = "error: unable to open output directory 'does" ++ s ++ "not" ++ s ++ "exist': FileNotFound\n"; | 703 | const expected = "error: unable to open output directory 'does" ++ s ++ "not" ++ s ++ "exist': FileNotFound\n"; |
| ... | @@ -785,7 +780,6 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -785,7 +780,6 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 785 | // owners. | 780 | // owners. |
| 786 | const tmp_path = b.makeTempPath(); | 781 | const tmp_path = b.makeTempPath(); |
| 787 | const unformatted_code = " // no reason for indent"; | 782 | const unformatted_code = " // no reason for indent"; |
| 788 | const s = std.fs.path.sep_str; | | |
| 789 | | 783 | |
| 790 | var dir = std.fs.cwd().openDir(tmp_path, .{}) catch @panic("unhandled"); | 784 | var dir = std.fs.cwd().openDir(tmp_path, .{}) catch @panic("unhandled"); |
| 791 | defer dir.close(); | 785 | defer dir.close(); |