From 27b93804fbef1544cb07718d3f0a451f4c4cd6c0 Mon Sep 17 00:00:00 2001 From: teto <886074+teto@users.noreply.github.com> Date: Wed, 25 Feb 2026 17:43:06 +0100 Subject: [PATCH] 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 --- .../modules/programs/neovim/wrapper-args.nix | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/modules/programs/neovim/wrapper-args.nix b/tests/modules/programs/neovim/wrapper-args.nix index 6e79d529..6f2f63cb 100644 --- a/tests/modules/programs/neovim/wrapper-args.nix +++ b/tests/modules/programs/neovim/wrapper-args.nix @@ -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