authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-14 14:44:38-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-15 10:48:15-07:00
loged33901218363b9d1baee4c37e85f573dc034e06
tree9161dd89ba989f4daaf4d1848589ba5c7521250b
parent37a7d2c78d27a327c70bb6865e1c6d114459a3af

test-cli: fix expected stderr on windows

Needed to account for backward slashes in file system paths.

1 files changed, 8 insertions(+), 14 deletions(-)

test/tests.zig+8-14
......@@ -660,20 +660,19 @@ pub fn addLinkTests(
660660
661661pub fn addCliTests(b: *std.Build) *Step {
662662 const step = b.step("test-cli", "Test the command line interface");
663 const s = std.fs.path.sep_str;
663664
664665 {
666
665667 // Test `zig init-lib`.
666668 const tmp_path = b.makeTempPath();
667669 const init_lib = b.addSystemCommand(&.{ b.zig_exe, "init-lib" });
668670 init_lib.cwd = tmp_path;
669671 init_lib.setName("zig init-lib");
670672 init_lib.expectStdOutEqual("");
671 init_lib.expectStdErrEqual(
672 \\info: Created build.zig
673 \\info: Created src/main.zig
674 \\info: Next, try `zig build --help` or `zig build test`
675 \\
676 );
673 init_lib.expectStdErrEqual("info: Created build.zig\n" ++
674 "info: Created src" ++ s ++ "main.zig\n" ++
675 "info: Next, try `zig build --help` or `zig build test`\n");
677676
678677 const run_test = b.addSystemCommand(&.{ b.zig_exe, "build", "test" });
679678 run_test.cwd = tmp_path;
......@@ -694,15 +693,11 @@ pub fn addCliTests(b: *std.Build) *Step {
694693 init_exe.cwd = tmp_path;
695694 init_exe.setName("zig init-exe");
696695 init_exe.expectStdOutEqual("");
697 init_exe.expectStdErrEqual(
698 \\info: Created build.zig
699 \\info: Created src/main.zig
700 \\info: Next, try `zig build --help` or `zig build run`
701 \\
702 );
696 init_exe.expectStdErrEqual("info: Created build.zig\n" ++
697 "info: Created src" ++ s ++ "main.zig\n" ++
698 "info: Next, try `zig build --help` or `zig build run`\n");
703699
704700 // Test missing output path.
705 const s = std.fs.path.sep_str;
706701 const bad_out_arg = "-femit-bin=does" ++ s ++ "not" ++ s ++ "exist" ++ s ++ "foo.exe";
707702 const ok_src_arg = "src" ++ s ++ "main.zig";
708703 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 {
785780 // owners.
786781 const tmp_path = b.makeTempPath();
787782 const unformatted_code = " // no reason for indent";
788 const s = std.fs.path.sep_str;
789783
790784 var dir = std.fs.cwd().openDir(tmp_path, .{}) catch @panic("unhandled");
791785 defer dir.close();