mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
tests: use callTest
pattern
Allows using the `callPackage(s)` pattern on tests. Rather than using `pkgs.callPackage`, we implement our own variant using `lib.callPackageWith`. Our variant (`callTest`) includes additional nixvim-specific stuff commonly used by our tests.
This commit is contained in:
parent
990ef039f7
commit
4a508ceee2
3 changed files with 42 additions and 43 deletions
|
@ -7,47 +7,43 @@
|
|||
self, # The flake instance
|
||||
}:
|
||||
let
|
||||
inherit (self.legacyPackages.${system})
|
||||
makeNixvimWithModule
|
||||
nixvimConfiguration
|
||||
;
|
||||
autoArgs = pkgs // {
|
||||
inherit
|
||||
helpers
|
||||
lib
|
||||
pkgsUnfree
|
||||
self
|
||||
system
|
||||
;
|
||||
inherit (self.legacyPackages.${system})
|
||||
makeNixvimWithModule
|
||||
nixvimConfiguration
|
||||
;
|
||||
inherit (self.lib.${system}.check)
|
||||
mkTestDerivationFromNvim
|
||||
mkTestDerivationFromNixvimModule
|
||||
;
|
||||
# Recursive:
|
||||
inherit callTest callTests;
|
||||
};
|
||||
|
||||
callTest = lib.callPackageWith autoArgs;
|
||||
callTests = lib.callPackagesWith autoArgs;
|
||||
in
|
||||
{
|
||||
extra-args-tests = import ./extra-args.nix {
|
||||
inherit pkgs;
|
||||
inherit makeNixvimWithModule;
|
||||
};
|
||||
extend = import ./extend.nix { inherit pkgs makeNixvimWithModule; };
|
||||
extra-files = import ./extra-files.nix { inherit pkgs makeNixvimWithModule; };
|
||||
enable-except-in-tests = import ./enable-except-in-tests.nix {
|
||||
inherit pkgs makeNixvimWithModule;
|
||||
inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule;
|
||||
};
|
||||
failing-tests = pkgs.callPackage ./failing-tests.nix {
|
||||
inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule;
|
||||
};
|
||||
no-flake = import ./no-flake.nix {
|
||||
inherit system;
|
||||
inherit (self.lib.${system}.check) mkTestDerivationFromNvim;
|
||||
nixvim = "${self}";
|
||||
};
|
||||
lib-tests = import ./lib-tests.nix {
|
||||
inherit pkgs helpers;
|
||||
inherit (pkgs) lib;
|
||||
};
|
||||
maintainers = import ./maintainers.nix { inherit pkgs; };
|
||||
plugins-by-name = pkgs.callPackage ./plugins-by-name.nix { inherit nixvimConfiguration; };
|
||||
generated = pkgs.callPackage ./generated.nix { };
|
||||
package-options = pkgs.callPackage ./package-options.nix { inherit nixvimConfiguration; };
|
||||
lsp-all-servers = pkgs.callPackage ./lsp-servers.nix { inherit nixvimConfiguration; };
|
||||
extra-args-tests = callTest ./extra-args.nix { };
|
||||
extend = callTest ./extend.nix { };
|
||||
extra-files = callTest ./extra-files.nix { };
|
||||
enable-except-in-tests = callTest ./enable-except-in-tests.nix { };
|
||||
failing-tests = callTest ./failing-tests.nix { };
|
||||
no-flake = callTest ./no-flake.nix { };
|
||||
lib-tests = callTest ./lib-tests.nix { };
|
||||
maintainers = callTest ./maintainers.nix { };
|
||||
plugins-by-name = callTest ./plugins-by-name.nix { };
|
||||
generated = callTest ./generated.nix { };
|
||||
package-options = callTest ./package-options.nix { };
|
||||
lsp-all-servers = callTest ./lsp-servers.nix { };
|
||||
}
|
||||
# Tests generated from ./test-sources
|
||||
# Grouped as a number of link-farms in the form { test-1, test-2, ... test-N }
|
||||
// import ./main.nix {
|
||||
inherit
|
||||
lib
|
||||
pkgs
|
||||
pkgsUnfree
|
||||
helpers
|
||||
;
|
||||
}
|
||||
// callTests ./main.nix { }
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
# Collects the various test modules in tests/test-sources/ and groups them into a number of test derivations
|
||||
{
|
||||
lib ? pkgs.lib,
|
||||
callPackage,
|
||||
callTest,
|
||||
helpers,
|
||||
lib ? pkgs.lib,
|
||||
pkgs,
|
||||
pkgsUnfree,
|
||||
}:
|
||||
let
|
||||
fetchTests = import ./fetch-tests.nix { inherit lib pkgs helpers; };
|
||||
test-derivation = import ../lib/tests.nix { inherit pkgs lib; };
|
||||
fetchTests = callTest ./fetch-tests.nix { };
|
||||
test-derivation = callPackage ../lib/tests.nix { };
|
||||
inherit (test-derivation) mkTestDerivationFromNixvimModule;
|
||||
|
||||
moduleToTest =
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
nixvim ? "${self}",
|
||||
self ? throw "either supply `self` or `nixvim`",
|
||||
system,
|
||||
nixvim,
|
||||
mkTestDerivationFromNvim,
|
||||
}:
|
||||
let
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue