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.
This commit is contained in:
Matt Sturgeon 2024-06-29 20:16:16 +01:00
parent 049bbc168f
commit 10f64e6c96
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
4 changed files with 28 additions and 47 deletions

View file

@ -3,25 +3,21 @@
perSystem =
{
pkgs,
config,
pkgsUnfree,
system,
helpers,
makeNixvimWithModuleUnfree,
makeNixvimWithModule,
...
}:
{
checks = {
tests = import ../tests {
inherit pkgs helpers makeNixvimWithModule;
inherit (pkgs) lib;
makeNixvim =
configuration:
makeNixvimWithModuleUnfree {
module = {
config = configuration;
};
};
inherit
pkgs
pkgsUnfree
helpers
makeNixvimWithModule
;
};
extra-args-tests = import ../tests/extra-args.nix {