tests: general cleanup

- Refactor much of `tests/fetch-tests.nix`
- Move `mkTest` up to let-block in `tests/default.nix`
This commit is contained in:
Matt Sturgeon 2024-08-22 13:46:05 +01:00
parent 087f70cb0a
commit fe12a092f6
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 55 additions and 63 deletions

View file

@ -9,6 +9,16 @@ let
test-derivation = import ../lib/tests.nix { inherit pkgs lib; };
inherit (test-derivation) mkTestDerivationFromNixvimModule;
mkTest =
{ name, module }:
{
inherit name;
path = mkTestDerivationFromNixvimModule {
inherit name module;
pkgs = pkgsUnfree;
};
};
# List of files containing configurations
testFiles = fetchTests {
inherit lib pkgs helpers;
@ -17,7 +27,7 @@ let
exampleFiles = {
name = "examples";
cases =
modules =
let
config = import ../example.nix { inherit pkgs; };
in
@ -37,24 +47,10 @@ let
in
# We attempt to build & execute all configurations
lib.pipe (testFiles ++ [ exampleFiles ]) [
(builtins.map (
file:
let
mkTest =
{ name, module }:
{
inherit name;
path = mkTestDerivationFromNixvimModule {
inherit name module;
pkgs = pkgsUnfree;
};
};
in
{
inherit (file) name;
path = pkgs.linkFarm file.name (builtins.map mkTest file.cases);
}
))
(builtins.map (file: {
inherit (file) name;
path = pkgs.linkFarm file.name (builtins.map mkTest file.modules);
}))
(helpers.groupListBySize 10)
(lib.imap1 (
i: group: rec {