wrapper-manager-fds/tests: update test structure for configs

This commit is contained in:
Gabriel Arazas 2024-09-21 19:32:08 +08:00
parent b667a335de
commit 19a035da58
7 changed files with 26 additions and 15 deletions

View File

@ -45,6 +45,7 @@
system: system:
let let
pkgs = import sources.nixos-unstable { inherit system; }; pkgs = import sources.nixos-unstable { inherit system; };
inherit (pkgs) lib;
tests = import ./tests { inherit pkgs; }; tests = import ./tests { inherit pkgs; };
docs = import ./docs { inherit pkgs; }; docs = import ./docs { inherit pkgs; };
in in
@ -60,7 +61,9 @@
website = docs.website; website = docs.website;
}; };
checks.wrapperManagerLibrarySetPkg = tests.libTestPkg; checks =
{ inherit (tests) lib; }
// lib.mapAttrs' (n: v: lib.nameValuePair "config-test-${n}" v) tests.configs;
} }
)); ));
} }

View File

@ -7,11 +7,14 @@ in
let let
wmLib = (import ../../. { }).lib; wmLib = (import ../../. { }).lib;
build = modules: wmLib.build { inherit pkgs modules; }; build = args: wmLib.build (args // { inherit pkgs; });
in in
{ {
fastfetch = build [ ./wrapper-fastfetch.nix ]; fastfetch = build { modules = [ ./wrapper-fastfetch.nix ]; };
neofetch = build [ ./wrapper-neofetch.nix ]; neofetch = build {
single-basepackage = build [ ./single-basepackage.nix ]; modules = [ ./wrapper-neofetch.nix ];
neofetch-with-additional-files = build [ ./neofetch-with-additional-files.nix ]; specialArgs.yourMomName = "Yor mom";
};
single-basepackage = build { modules = [ ./single-basepackage.nix ]; };
neofetch-with-additional-files = build { modules = [ ./neofetch-with-additional-files.nix ]; };
} }

View File

@ -37,7 +37,7 @@
WHAT WHAT
''; '';
build.extraPassthru.tests = { build.extraPassthru.wrapperManagerTests = {
actuallyBuilt = actuallyBuilt =
let let
wrapper = config.build.toplevel; wrapper = config.build.toplevel;

View File

@ -13,7 +13,7 @@
xdg.desktopEntry.enable = true; xdg.desktopEntry.enable = true;
}; };
build.extraPassthru.tests = { build.extraPassthru.wrapperManagerTests = {
singleBasePackage = singleBasePackage =
let let
wrapper = config.build.toplevel; wrapper = config.build.toplevel;

View File

@ -23,7 +23,7 @@
hello hello
]); ]);
build.extraPassthru.tests = { build.extraPassthru.wrapperManagerTests = {
actuallyBuilt = actuallyBuilt =
let let
wrapper = config.build.toplevel; wrapper = config.build.toplevel;

View File

@ -20,7 +20,7 @@
]; ];
}; };
build.extraPassthru.tests = { build.extraPassthru.wrapperManagerTests = {
actuallyBuilt = actuallyBuilt =
let let
wrapper = config.build.toplevel; wrapper = config.build.toplevel;

View File

@ -6,14 +6,20 @@ in
}: }:
let let
lib = import ./lib { inherit pkgs; }; wrapperManagerLibTests = import ./lib { inherit pkgs; };
inherit (pkgs) lib;
in in
{ {
inherit lib; configs = let
libTestPkg = configs' = import ./configs { inherit pkgs; };
updateTestName = configName: package: lib.mapAttrs' (n: v: lib.nameValuePair "${configName}-${n}" v) package.wrapperManagerTests;
in
lib.concatMapAttrs updateTestName configs';
lib =
pkgs.runCommand "wrapper-manager-fds-lib-test" pkgs.runCommand "wrapper-manager-fds-lib-test"
{ {
testData = builtins.toJSON lib; testData = builtins.toJSON wrapperManagerLibTests;
passAsFile = [ "testData" ]; passAsFile = [ "testData" ];
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
yajsv yajsv
@ -23,5 +29,4 @@ in
'' ''
yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath" yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath"
''; '';
configs = import ./configs { inherit pkgs; };
} }