tests/neovim: add wrapper args test
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
ab01ea24b2
commit
0a583021ea
2 changed files with 84 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
neovim-plugin-config = ./plugin-config.nix;
|
||||
neovim-coc-config = ./coc-config.nix;
|
||||
neovim-runtime = ./runtime.nix;
|
||||
neovim-wrapper-args = ./wrapper-args.nix;
|
||||
|
||||
# waiting for a nixpkgs patch
|
||||
neovim-no-init = ./no-init.nix;
|
||||
|
|
|
|||
83
tests/modules/programs/neovim/wrapper-args.nix
Normal file
83
tests/modules/programs/neovim/wrapper-args.nix
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs.stdenv.hostPlatform) isLinux;
|
||||
|
||||
dummyDep = pkgs.runCommand "dummy-dep" { } ''
|
||||
mkdir -p $out/bin
|
||||
echo "echo dummy" > $out/bin/dummy-dep-bin
|
||||
chmod +x $out/bin/dummy-dep-bin
|
||||
'';
|
||||
|
||||
dummyPlugin = pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "dummy-plugin";
|
||||
version = "1.0";
|
||||
src = pkgs.writeTextDir "plugin/dummy.vim" "\" dummy";
|
||||
runtimeDeps = [ dummyDep ];
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ ./stubs.nix ];
|
||||
tests.stubs.wl-clipboard = { };
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
extraName = "-my-suffix";
|
||||
withPerl = true;
|
||||
withPython3 = true;
|
||||
withRuby = true;
|
||||
withNodeJs = true;
|
||||
autowrapRuntimeDeps = true;
|
||||
waylandSupport = isLinux;
|
||||
plugins = [ dummyPlugin ];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
nvimBin="home-path/bin/nvim"
|
||||
|
||||
assertBinaryContains() {
|
||||
local file="$TESTED/$1"
|
||||
if [[ $1 == /* ]]; then file="$1"; fi
|
||||
|
||||
if ! grep -a -qF -- "$2" "$file"; then
|
||||
fail "Expected binary file '$1' to contain '$2' but it did not."
|
||||
fi
|
||||
}
|
||||
|
||||
# Ensure the main binary exists
|
||||
assertFileExists "$nvimBin"
|
||||
|
||||
# 1. extraName: Check if the suffix is in the rplugin manifest path within the wrapper
|
||||
assertBinaryContains "$nvimBin" "-my-suffix/rplugin.vim"
|
||||
|
||||
# 2. withPerl: Check if nvim-perl binary exists and host prog is set
|
||||
assertFileExists "home-path/bin/nvim-perl"
|
||||
assertBinaryContains "$nvimBin" "perl_host_prog="
|
||||
|
||||
# 3. withPython3: Check if nvim-python3 binary exists and host prog is set
|
||||
assertFileExists "home-path/bin/nvim-python3"
|
||||
assertBinaryContains "$nvimBin" "python3_host_prog="
|
||||
|
||||
# 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="
|
||||
|
||||
# 5. withNodeJs: Check if nvim-node binary exists and host prog is set
|
||||
assertFileExists "home-path/bin/nvim-node"
|
||||
assertBinaryContains "$nvimBin" "node_host_prog="
|
||||
|
||||
# 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
|
||||
${lib.optionalString isLinux ''
|
||||
assertBinaryContains "$nvimBin" "wl-clipboard-"
|
||||
''}
|
||||
|
||||
# 7. autowrapRuntimeDeps: Check for dummyDep path in wrapper's PATH modification
|
||||
assertBinaryContains "$nvimBin" "${dummyDep}/bin"
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue