mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-22 08:14:00 +01:00
tests: Remove hint
At some point this broke, although imports should be changed infrequently enough that any failures should be trivial to resolve.
This commit is contained in:
parent
ef7cac947e
commit
a3ca695d4e
@ -1,8 +1,6 @@
|
|||||||
require "spec"
|
require "spec"
|
||||||
require "colorize"
|
require "colorize"
|
||||||
|
|
||||||
hint = ""
|
|
||||||
|
|
||||||
def check_top_level_imports(directory)
|
def check_top_level_imports(directory)
|
||||||
describe "./#{directory}/default.nix" do
|
describe "./#{directory}/default.nix" do
|
||||||
it "imports all modules in ./#{directory}/", tags: "local" do
|
it "imports all modules in ./#{directory}/", tags: "local" do
|
||||||
@ -11,11 +9,8 @@ def check_top_level_imports(directory)
|
|||||||
modules = File.read("./#{directory}/default.nix")
|
modules = File.read("./#{directory}/default.nix")
|
||||||
|
|
||||||
all_modules.each do |current_module|
|
all_modules.each do |current_module|
|
||||||
hint = "Missing ./#{current_module} import in ./#{directory}/default.nix."
|
|
||||||
modules.includes?("./#{current_module}").should be_true
|
modules.includes?("./#{current_module}").should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
hint = ""
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "only imports modules that exist in ./#{directory}/", tags: "local" do
|
it "only imports modules that exist in ./#{directory}/", tags: "local" do
|
||||||
@ -25,16 +20,9 @@ def check_top_level_imports(directory)
|
|||||||
File.each_line("./#{directory}/default.nix") do |line|
|
File.each_line("./#{directory}/default.nix") do |line|
|
||||||
if line.includes? "./"
|
if line.includes? "./"
|
||||||
imported_file = line.lstrip(' ').lstrip("./")
|
imported_file = line.lstrip(' ').lstrip("./")
|
||||||
hint = "./#{imported_file} was imported but doesn't exist in directory ./#{directory}/."
|
|
||||||
all_modules.includes?(imported_file).should be_true
|
all_modules.includes?(imported_file).should be_true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
hint = ""
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Spec.after_suite do
|
|
||||||
hint.empty? || puts "✗ #{hint}".colorize(:yellow)
|
|
||||||
end
|
|
||||||
|
Loading…
Reference in New Issue
Block a user