From d253cca017de96e1a28bc3796f013892f4d57259 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 13 Jun 2022 10:03:40 +0200 Subject: [PATCH] Add script for neovim tests This will be used to check the indentation queries. --- flake.nix | 16 ++++++++++++++++ scripts/minimal_init.lua | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 scripts/minimal_init.lua diff --git a/flake.nix b/flake.nix index abf41a5..5403e1a 100644 --- a/flake.nix +++ b/flake.nix @@ -54,6 +54,14 @@ overlays = [ self.overlays.default ]; }; + nvim-test = pkgs.writeShellScriptBin "nvim-test" '' + export NVIM_PLENARY='${pkgs.vimPlugins.plenary-nvim}' + export NVIM_TREESITTER='${pkgs.vimPlugins.nvim-treesitter}' + + ${pkgs.neovim}/bin/nvim --headless --noplugin -u scripts/minimal_init.lua \ + -c "PlenaryBustedDirectory test/ { minimal_init = './scripts/minimal_init.lua' }" + ''; + tree-sitter-env = pkgs.stdenv.mkDerivation { name = "tree-sitter-env"; @@ -94,6 +102,13 @@ enable = true; }; + nvim-test = { + enable = true; + name = "nvim tests"; + entry = "${nvim-test}/bin/nvim-test"; + pass_filenames = false; + }; + tree-sitter = { enable = true; name = "tree-sitter tests"; @@ -115,6 +130,7 @@ default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ nodejs + nvim-test (tree-sitter.override { webUISupport = true; }) ]; diff --git a/scripts/minimal_init.lua b/scripts/minimal_init.lua new file mode 100644 index 0000000..3772e97 --- /dev/null +++ b/scripts/minimal_init.lua @@ -0,0 +1,13 @@ +vim.cmd([[set runtimepath+=$NVIM_PLENARY]]) +vim.cmd([[set runtimepath+=$NVIM_TREESITTER]]) + +vim.cmd([[runtime! plugin/plenary.vim]]) +vim.cmd([[runtime! plugin/nvim-treesitter.lua]]) + +vim.o.swapfile = false +vim.bo.swapfile = false + +require("nvim-treesitter.configs").setup({ + indent = { enable = true }, + highlight = { enable = true }, +})