mirror of
https://github.com/nix-community/nixvim.git
synced 2025-12-16 14:01:10 +01:00
lib/modules: init testNixvim and testNixvimWith
Introduce thin wrappers around the `<configuration>.config.build.test` option, intended to replace the legacy `mkTestDerivationFromNvim` and `mkTestDerivationFromNixvimModule` functions.
This commit is contained in:
parent
2695bef079
commit
8486f9144e
2 changed files with 46 additions and 0 deletions
|
|
@ -98,6 +98,47 @@ in
|
|||
buildNixvimWith = lib.mirrorFunctionArgs self.modules.evalNixvim (
|
||||
args: (self.modules.evalNixvim args).config.build.package
|
||||
);
|
||||
|
||||
/**
|
||||
Build a Nixvim test derivation.
|
||||
|
||||
# Inputs
|
||||
|
||||
`input`
|
||||
: One of:
|
||||
1. A Nixvim module or a list of modules.
|
||||
2. A Nixvim configuration.
|
||||
3. A Nixvim package.
|
||||
|
||||
# Output
|
||||
|
||||
A buildable Nixvim test.
|
||||
*/
|
||||
testNixvim =
|
||||
input:
|
||||
if lib.isDerivation input then
|
||||
lib.throwIfNot (input ? config.build.test)
|
||||
"testNixvim: received a derivation without the expected `config` attribute."
|
||||
input.config.build.test
|
||||
else if lib.isType "configuration" input then
|
||||
lib.throwIfNot (input ? config.build.test)
|
||||
"testNixvim: received a configuration without the expected `build.test` option."
|
||||
input.config.build.test
|
||||
else
|
||||
self.modules.testNixvimWith {
|
||||
modules = lib.toList input;
|
||||
};
|
||||
|
||||
/**
|
||||
Build a Nixvim test derivation using the same interface as `evalNixvim`.
|
||||
|
||||
# Output
|
||||
|
||||
A buildable Nixvim test.
|
||||
*/
|
||||
testNixvimWith = lib.mirrorFunctionArgs self.modules.evalNixvim (
|
||||
args: (self.modules.evalNixvim args).config.build.test
|
||||
);
|
||||
}
|
||||
// lib.mapAttrs (
|
||||
name: msg:
|
||||
|
|
|
|||
|
|
@ -551,6 +551,11 @@ let
|
|||
expr = lib.functionArgs lib.nixvim.modules.buildNixvimWith;
|
||||
expected = lib.functionArgs lib.nixvim.modules.evalNixvim;
|
||||
};
|
||||
|
||||
testNixvimWith_hasExpectedArgs = {
|
||||
expr = lib.functionArgs lib.nixvim.modules.testNixvimWith;
|
||||
expected = lib.functionArgs lib.nixvim.modules.evalNixvim;
|
||||
};
|
||||
};
|
||||
in
|
||||
if results == [ ] then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue