mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-22 00:03:55 +01:00
tests: Only import modules that exist
This commit is contained in:
parent
ad377d14fa
commit
36ddba7e9b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user