From 539e90e26d86b7e8fbc81f069a062beb7a43edb3 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Fri, 2 Oct 2020 19:59:00 +0200 Subject: [PATCH] Print error when running `zig test/run` without a source file Closes #6498 --- src/main.zig | 4 ++++ 1 file changed, 4 insertions(+) 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";