aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandros Naskos <alex_naskos@hotmail.com>2020-10-03 12:47:49 +0300
committerGitHub <noreply@github.com>2020-10-03 12:47:49 +0300
commitb5034bd7765565f838466d8b212140097a1eefba (patch)
tree054e9775ae3e45c4da13499dbada554a72af6b46
parente9434ff8f46ec27a863d0b071c0a99b4f01588dc (diff)
parent539e90e26d86b7e8fbc81f069a062beb7a43edb3 (diff)
downloadzig-b5034bd7765565f838466d8b212140097a1eefba.tar.gz
zig-b5034bd7765565f838466d8b212140097a1eefba.zip
Merge pull request #6506 from FireFox317/stage2-cli
Print error when running `zig test/run` without a source file
-rw-r--r--src/main.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index f1883230ec..d1017a911d 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1210,6 +1210,10 @@ fn buildOutputType(
fatal("translate-c expects exactly 1 source file (found {})", .{c_source_files.items.len});
}
+ if (root_src_file == null and (arg_mode == .zig_test or arg_mode == .run)) {
+ fatal("one zig source file is required to run this command", .{});
+ }
+
const root_name = if (provided_name) |n| n else blk: {
if (arg_mode == .zig_test) {
break :blk "test";