diff --git a/tests/main.cr b/tests/main.cr index 7c5efba2..e5fb2f86 100644 --- a/tests/main.cr +++ b/tests/main.cr @@ -5,7 +5,7 @@ require "./spec_helper" hint = "" describe "./modules/default.nix" do - it "imports all modules" do + it "imports all modules in directory" do all_modules = Dir.children("modules") all_modules.delete("default.nix") modules = File.read("./modules/default.nix") @@ -17,6 +17,21 @@ describe "./modules/default.nix" do hint = "" end + + it "only imports modules that exist" do + all_modules = Dir.children("modules") + all_modules.delete("default.nix") + + File.each_line("./modules/default.nix") do |line| + if line.includes? "./" + imported_file = line.lstrip(' ').lstrip("./") + hint = "./#{imported_file} was imported but doesn't exist in directory ./modules/." + all_modules.includes?(imported_file).should be_true + end + end + + hint = "" + end end describe "./overlays/joshuto/default.nix" do