2023-03-22 07:42:02 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
tests/test-derivation: allow tests to be modules
Use `mkTestDerivationFromNixvimModule` instead of `mkTestDerivation`,
allowing "proper" modules to be used instead of plain attr configs.
This is useful for more complex tests that wish to use `config` or
`options` arguments, e.g:
```nix
{config, options, ...}: {
/* some cool test */
}
```
To allow `tests.dontRun` to be defined on such a test, the module is
allowed to be nested as `module`, e.g:
```nix
{
tests.dontRun = true;
module = {config, options, ...}: {
/* a disabled test */
};
}
```
Also ended up doing some general cleanup, removing an unused function,
etc.
2024-06-29 20:16:16 +01:00
|
|
|
pkgsUnfree,
|
2024-10-18 09:44:59 +01:00
|
|
|
helpers,
|
|
|
|
lib,
|
2024-12-14 18:54:27 +00:00
|
|
|
linkFarm,
|
2024-10-18 09:44:59 +01:00
|
|
|
self, # The flake instance
|
2024-12-14 22:41:16 +00:00
|
|
|
system ? pkgs.stdenv.hostPlatform.system,
|
2024-05-05 19:39:35 +02:00
|
|
|
}:
|
|
|
|
let
|
2024-10-17 19:59:37 +01:00
|
|
|
autoArgs = pkgs // {
|
|
|
|
inherit
|
|
|
|
helpers
|
|
|
|
pkgsUnfree
|
|
|
|
self
|
|
|
|
system
|
|
|
|
;
|
2024-12-15 21:13:45 +01:00
|
|
|
nixpkgsLib = lib;
|
2024-12-21 12:58:33 +00:00
|
|
|
lib = lib.extend self.lib.overlay;
|
2024-10-17 19:59:37 +01:00
|
|
|
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;
|
2024-12-14 18:54:27 +00:00
|
|
|
|
|
|
|
selfPackages = self.packages.${system};
|
2024-07-19 20:22:19 +02:00
|
|
|
in
|
2024-10-18 09:44:59 +01:00
|
|
|
{
|
2024-10-17 19:59:37 +01:00
|
|
|
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 { };
|
2024-10-18 09:44:59 +01:00
|
|
|
}
|
2024-12-14 18:54:27 +00:00
|
|
|
# Expose some tests from the docs as flake-checks too
|
|
|
|
// lib.optionalAttrs (selfPackages ? docs) {
|
|
|
|
# Individual tests can be run using: nix build .#docs.user-configs.tests.<test>
|
|
|
|
docs-user-configs = linkFarm "user-configs-tests" selfPackages.docs.user-configs.tests;
|
|
|
|
}
|
2024-10-18 09:44:59 +01:00
|
|
|
# Tests generated from ./test-sources
|
|
|
|
# Grouped as a number of link-farms in the form { test-1, test-2, ... test-N }
|
2024-10-17 19:59:37 +01:00
|
|
|
// callTests ./main.nix { }
|