diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-09-17 17:08:56 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-09-17 17:11:18 -0400 |
| commit | 4c6f1e614a204293732004ef844e8bb057bdc212 (patch) | |
| tree | 5b9ce7cf5888d2122406b79001325ed770d5d872 /test/tests.zig | |
| parent | 9c9eefc841b577f646a54e74c8970e074162b594 (diff) | |
| download | zig-4c6f1e614a204293732004ef844e8bb057bdc212.tar.gz zig-4c6f1e614a204293732004ef844e8bb057bdc212.zip | |
remove `zig build --init`. add `zig init-lib` and `zig init-exe`
init-lib creates a working static library with tests, and
init-exe creates a working hello world with a `run` target.
both now have test coverage with the new "cli tests" file.
closes #1035
Diffstat (limited to 'test/tests.zig')
| -rw-r--r-- | test/tests.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/tests.zig b/test/tests.zig index a0e1792079..88908e8775 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -103,6 +103,21 @@ pub fn addBuildExampleTests(b: *build.Builder, test_filter: ?[]const u8, modes: return cases.step; } +pub fn addCliTests(b: *build.Builder, test_filter: ?[]const u8, modes: []const Mode) *build.Step { + const step = b.step("test-cli", "Test the command line interface"); + + const exe = b.addExecutable("test-cli", "test/cli.zig"); + const run_cmd = b.addCommand(null, b.env_map, [][]const u8{ + b.pathFromRoot(exe.getOutputPath()), + os.path.realAlloc(b.allocator, b.zig_exe) catch unreachable, + b.pathFromRoot(b.cache_root), + }); + run_cmd.step.dependOn(&exe.step); + + step.dependOn(&run_cmd.step); + return step; +} + pub fn addAssembleAndLinkTests(b: *build.Builder, test_filter: ?[]const u8, modes: []const Mode) *build.Step { const cases = b.allocator.create(CompareOutputContext{ .b = b, |
