mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 06:19:00 +00:00
tests/lib: init
WE NOW HAVE TESTS ~3 YEARS INTO DEVELOPMENT, BOI!
This commit is contained in:
parent
7c34617479
commit
0c78d7b32b
5
tests/default.nix
Normal file
5
tests/default.nix
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> { } }:
|
||||||
|
|
||||||
|
{
|
||||||
|
lib = import ./lib { inherit pkgs; };
|
||||||
|
}
|
20
tests/lib/default.nix
Normal file
20
tests/lib/default.nix
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
foodogsquaredLib = (import ../../lib { inherit pkgs; }).extend (final: prev:
|
||||||
|
let
|
||||||
|
callLib = file: import file { inherit pkgs lib; self = prev; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
nixos = callLib ../../lib/nixos.nix;
|
||||||
|
home-manager = callLib ../../lib/home-manager.nix;
|
||||||
|
nixvim = callLib ../../lib/nixvim.nix;
|
||||||
|
});
|
||||||
|
|
||||||
|
callLib = file: import file { inherit pkgs lib; self = foodogsquaredLib; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
trivial = callLib ./trivial.nix;
|
||||||
|
#home-manager = callLib ./home-manager.nix;
|
||||||
|
}
|
20
tests/lib/trivial.nix
Normal file
20
tests/lib/trivial.nix
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{ pkgs, lib, self }:
|
||||||
|
|
||||||
|
lib.runTests {
|
||||||
|
testCountAttrs = {
|
||||||
|
expr = self.trivial.countAttrs (n: v: v?enable && v.enable) {
|
||||||
|
hello.enable = true;
|
||||||
|
what.enable = false;
|
||||||
|
atro.enable = true;
|
||||||
|
adelie = { };
|
||||||
|
world = "there";
|
||||||
|
mo = null;
|
||||||
|
};
|
||||||
|
expected = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
testGetConfig = {
|
||||||
|
expr = self.trivial.getConfig "home-manager" "foo-dogsquared";
|
||||||
|
expected = ../../configs/home-manager/foo-dogsquared;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user