mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-22 08:14:00 +01:00
meta: Add tests
Tests help guarantee that I don't forget to do something that I should have done, such as importing a certain nix module.
This commit is contained in:
parent
ac58a29d86
commit
d137d3342c
@ -61,7 +61,8 @@ in {
|
||||
utf16 = "recode utf16..utf8"; # Rarely, some files from Japan are utf16 instead
|
||||
jp = "LANG=ja_JP.UTF-8 LC_ALL=ja_JP.UTF-8";
|
||||
vm = "cd ~/nix-config && nixos-rebuild build-vm --flake . && ./result/bin/run-${VARIABLES.hostname}-vm && trash put result ${VARIABLES.hostname}.qcow2";
|
||||
sw = "cd ~/nix-config && sudo nixos-rebuild switch --flake .";
|
||||
sw = "cd ~/nix-config && crystal run tests/main.cr --progress && sudo nixos-rebuild switch --flake .";
|
||||
st = "cd ~/nix-config && crystal run tests/main.cr --progress";
|
||||
|
||||
c = "tput reset"; # Clear the terminal completely
|
||||
e = "exit";
|
||||
|
16
tests/main.cr
Normal file
16
tests/main.cr
Normal file
@ -0,0 +1,16 @@
|
||||
require "spec"
|
||||
require "colorize"
|
||||
|
||||
describe "nix-config" do
|
||||
it "includes all modules" do
|
||||
all_modules = Dir.children("modules")
|
||||
all_modules.delete("default.nix")
|
||||
modules = File.read("./modules/default.nix")
|
||||
|
||||
all_modules.each do |current_module|
|
||||
print "Checking ./modules/#{current_module}...".colorize(:blue)
|
||||
modules.includes?("./#{current_module}").should be_true
|
||||
puts "✓".colorize(:green)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user