mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +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
|
self, # The flake instance
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (self.legacyPackages.${system})
|
autoArgs = pkgs // {
|
||||||
makeNixvimWithModule
|
inherit
|
||||||
nixvimConfiguration
|
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
|
in
|
||||||
{
|
{
|
||||||
extra-args-tests = import ./extra-args.nix {
|
extra-args-tests = callTest ./extra-args.nix { };
|
||||||
inherit pkgs;
|
extend = callTest ./extend.nix { };
|
||||||
inherit makeNixvimWithModule;
|
extra-files = callTest ./extra-files.nix { };
|
||||||
};
|
enable-except-in-tests = callTest ./enable-except-in-tests.nix { };
|
||||||
extend = import ./extend.nix { inherit pkgs makeNixvimWithModule; };
|
failing-tests = callTest ./failing-tests.nix { };
|
||||||
extra-files = import ./extra-files.nix { inherit pkgs makeNixvimWithModule; };
|
no-flake = callTest ./no-flake.nix { };
|
||||||
enable-except-in-tests = import ./enable-except-in-tests.nix {
|
lib-tests = callTest ./lib-tests.nix { };
|
||||||
inherit pkgs makeNixvimWithModule;
|
maintainers = callTest ./maintainers.nix { };
|
||||||
inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule;
|
plugins-by-name = callTest ./plugins-by-name.nix { };
|
||||||
};
|
generated = callTest ./generated.nix { };
|
||||||
failing-tests = pkgs.callPackage ./failing-tests.nix {
|
package-options = callTest ./package-options.nix { };
|
||||||
inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule;
|
lsp-all-servers = callTest ./lsp-servers.nix { };
|
||||||
};
|
|
||||||
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; };
|
|
||||||
}
|
}
|
||||||
# Tests generated from ./test-sources
|
# Tests generated from ./test-sources
|
||||||
# Grouped as a number of link-farms in the form { test-1, test-2, ... test-N }
|
# Grouped as a number of link-farms in the form { test-1, test-2, ... test-N }
|
||||||
// import ./main.nix {
|
// callTests ./main.nix { }
|
||||||
inherit
|
|
||||||
lib
|
|
||||||
pkgs
|
|
||||||
pkgsUnfree
|
|
||||||
helpers
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
# Collects the various test modules in tests/test-sources/ and groups them into a number of test derivations
|
# Collects the various test modules in tests/test-sources/ and groups them into a number of test derivations
|
||||||
{
|
{
|
||||||
lib ? pkgs.lib,
|
callPackage,
|
||||||
|
callTest,
|
||||||
helpers,
|
helpers,
|
||||||
|
lib ? pkgs.lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
pkgsUnfree,
|
pkgsUnfree,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
fetchTests = import ./fetch-tests.nix { inherit lib pkgs helpers; };
|
fetchTests = callTest ./fetch-tests.nix { };
|
||||||
test-derivation = import ../lib/tests.nix { inherit pkgs lib; };
|
test-derivation = callPackage ../lib/tests.nix { };
|
||||||
inherit (test-derivation) mkTestDerivationFromNixvimModule;
|
inherit (test-derivation) mkTestDerivationFromNixvimModule;
|
||||||
|
|
||||||
moduleToTest =
|
moduleToTest =
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
|
nixvim ? "${self}",
|
||||||
|
self ? throw "either supply `self` or `nixvim`",
|
||||||
system,
|
system,
|
||||||
nixvim,
|
|
||||||
mkTestDerivationFromNvim,
|
mkTestDerivationFromNvim,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue