aboutsummaryrefslogtreecommitdiff
path: root/test/tests.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-11-20 23:01:45 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-11-20 23:01:45 -0700
commitf645022d16361865e24582d28f1e62312fbc73bb (patch)
tree7a7f03aff7bc7b9dc3f4ba1b3be57bd17caae1b7 /test/tests.zig
parent8ca4a5240e0258c84e437ed4a37972c8fff7842d (diff)
downloadzig-f645022d16361865e24582d28f1e62312fbc73bb.tar.gz
zig-f645022d16361865e24582d28f1e62312fbc73bb.zip
merge `zig init-exe` and `zig init-lib` into `zig init`
Instead of `zig init-lib` and `zig init-exe`, now there is only `zig init`, which initializes any of the template files that do not already exist, and makes a package that contains both an executable and a static library. The idea is that the user can delete whatever they don't want. In fact, I think even more things should be added to the build.zig template.
Diffstat (limited to 'test/tests.zig')
-rw-r--r--test/tests.zig37
1 files changed, 7 insertions, 30 deletions
diff --git a/test/tests.zig b/test/tests.zig
index 2603ca7670..c19e8647de 100644
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -776,39 +776,16 @@ pub fn addCliTests(b: *std.Build) *Step {
const s = std.fs.path.sep_str;
{
-
- // Test `zig init-lib`.
- const tmp_path = b.makeTempPath();
- const init_lib = b.addSystemCommand(&.{ b.zig_exe, "init-lib" });
- init_lib.setCwd(.{ .cwd_relative = tmp_path });
- init_lib.setName("zig init-lib");
- init_lib.expectStdOutEqual("");
- init_lib.expectStdErrEqual("info: Created build.zig\n" ++
- "info: Created src" ++ s ++ "main.zig\n" ++
- "info: Next, try `zig build --help` or `zig build test`\n");
-
- const run_test = b.addSystemCommand(&.{ b.zig_exe, "build", "test" });
- run_test.setCwd(.{ .cwd_relative = tmp_path });
- run_test.setName("zig build test");
- run_test.expectStdOutEqual("");
- run_test.step.dependOn(&init_lib.step);
-
- const cleanup = b.addRemoveDirTree(tmp_path);
- cleanup.step.dependOn(&run_test.step);
-
- step.dependOn(&cleanup.step);
- }
-
- {
- // Test `zig init-exe`.
+ // Test `zig init`.
const tmp_path = b.makeTempPath();
- const init_exe = b.addSystemCommand(&.{ b.zig_exe, "init-exe" });
+ const init_exe = b.addSystemCommand(&.{ b.zig_exe, "init" });
init_exe.setCwd(.{ .cwd_relative = tmp_path });
- init_exe.setName("zig init-exe");
+ init_exe.setName("zig init");
init_exe.expectStdOutEqual("");
- init_exe.expectStdErrEqual("info: Created build.zig\n" ++
- "info: Created src" ++ s ++ "main.zig\n" ++
- "info: Next, try `zig build --help` or `zig build run`\n");
+ init_exe.expectStdErrEqual("info: created build.zig\n" ++
+ "info: created src" ++ s ++ "main.zig\n" ++
+ "info: created src" ++ s ++ "root.zig\n" ++
+ "info: see `zig build --help` for a menu of options\n");
// Test missing output path.
const bad_out_arg = "-femit-bin=does" ++ s ++ "not" ++ s ++ "exist" ++ s ++ "foo.exe";