Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions lib/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,31 @@ in
in
configuration.config.build.package
);

/**
Build a Nixvim test derivation.

This is a thin wrapper around `<nixvim-configuration>.config.build.test`.

# Inputs

`input`
: One of:
1. Arguments for `evalNixvim`.
2. A Nixvim configuration, as produced by `evalNixvim`.
3. A Nixvim package, as produced by `buildNixvim`.

# Output

A buildable Nixvim test.
*/
testNixvim = lib.mirrorFunctionArgs self.modules.evalNixvim (
input:
let
configuration = if input ? config.build.package then input else self.modules.evalNixvim input;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe overkilled, but we could factorize this line in a separate function. Maybe that won't help with understanding though.

in
configuration.config.build.test
);
}
// lib.mapAttrs (
name: msg:
Expand Down
5 changes: 5 additions & 0 deletions tests/lib-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,11 @@ let
expr = lib.functionArgs lib.nixvim.modules.buildNixvim;
expected = lib.functionArgs lib.nixvim.modules.evalNixvim;
};

testNixvim_hasExpectedArgs = {
expr = lib.functionArgs lib.nixvim.modules.testNixvim;
expected = lib.functionArgs lib.nixvim.modules.evalNixvim;
};
};
in
if results == [ ] then
Expand Down