neovim: adapt provider tests

This checks the final provider value instead of the wrapper implementation.
This requires to run the real neovim so I removed the stub.

The providers at home-path/bin/nvim-X will disappear from nixpkgs
hopefully so I simplified the pattern to "X".

Probably in future we want to check "assertFileExists" against the
returned value node_host_prog
This commit is contained in:
teto 2026-02-25 17:43:06 +01:00 committed by Austin Horstman
parent c804204306
commit 27b93804fb

View file

@ -1,6 +1,7 @@
{
lib,
pkgs,
realPkgs,
...
}:
@ -21,11 +22,11 @@ let
};
in
{
imports = [ ./stubs.nix ];
tests.stubs.wl-clipboard = { };
programs.neovim = {
enable = true;
package = realPkgs.neovim-unwrapped;
extraName = "-my-suffix";
withPerl = true;
withPython3 = true;
@ -38,6 +39,8 @@ in
nmt.script = ''
nvimBin="home-path/bin/nvim"
export PATH="$TESTED/home-path/bin:$PATH"
export HOME="$TMPDIR/hm-user"
assertBinaryContains() {
local file="$TESTED/$1"
@ -48,6 +51,15 @@ in
fi
}
# Helper function to check host_prog provider configuration
assertNeovimExpr() {
local var_name="$1"
local expected_pattern="$2"
if ! nvim -i NONE --headless --cmd "echo $var_name" +q! 2>&1 | grep "$expected_pattern" ; then
fail "Provider $var_name doesn't match expected pattern '$expected_pattern'"
fi
}
# Ensure the main binary exists
assertFileExists "$nvimBin"
@ -56,20 +68,20 @@ in
# 2. withPerl: Check if nvim-perl binary exists and host prog is set
assertFileExists "home-path/bin/nvim-perl"
assertBinaryContains "$nvimBin" "perl_host_prog="
assertNeovimExpr "g:perl_host_prog" "nvim-perl"
# 3. withPython3: Check if nvim-python3 binary exists and host prog is set
assertFileExists "home-path/bin/nvim-python3"
assertBinaryContains "$nvimBin" "python3_host_prog="
assertNeovimExpr "g:python3_host_prog" "python3"
# 4. withRuby: Check if nvim-ruby binary exists, GEM_HOME and host prog are set
assertFileExists "home-path/bin/nvim-ruby"
assertBinaryContains "$nvimBin" "GEM_HOME="
assertBinaryContains "$nvimBin" "ruby_host_prog="
assertNeovimExpr "g:ruby_host_prog" "ruby"
# 5. withNodeJs: Check if nvim-node binary exists and host prog is set
assertFileExists "home-path/bin/nvim-node"
assertBinaryContains "$nvimBin" "node_host_prog="
assertNeovimExpr "g:node_host_prog" "node"
# 6. waylandSupport: Check for wl-clipboard path in wrapper's PATH modification
# We check for the store path of wl-clipboard in the current pkgs