Skip to content

Commit 918b47d

Browse files
committed
plugins/treesitter: extract combine-plugins test to separate file
1 parent c85bb99 commit 918b47d

File tree

2 files changed

+37
-35
lines changed

2 files changed

+37
-35
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{ pkgs, ... }:
2+
{
3+
combine-plugins = {
4+
performance.combinePlugins.enable = true;
5+
6+
plugins.treesitter = {
7+
enable = true;
8+
9+
# Exclude nixvim injections for test to pass
10+
nixvimInjections = false;
11+
};
12+
13+
extraConfigLuaPost = ''
14+
-- Ensure that queries from nvim-treesitter are first in rtp
15+
local queries_path = "${pkgs.vimPlugins.nvim-treesitter}/queries"
16+
for name, type in vim.fs.dir(queries_path, {depth = 10}) do
17+
if type == "file" then
18+
-- Resolve all symlinks and compare nvim-treesitter's path with
19+
-- whatever we've got from runtime
20+
local nvim_treesitter_path = assert(vim.uv.fs_realpath(vim.fs.joinpath(queries_path, name)))
21+
local rtp_path = assert(
22+
vim.uv.fs_realpath(vim.api.nvim_get_runtime_file("queries/" .. name, false)[1]),
23+
name .. " not found in runtime"
24+
)
25+
assert(
26+
nvim_treesitter_path == rtp_path,
27+
string.format(
28+
"%s from rtp (%s) is not the same as from nvim-treesitter (%s)",
29+
name,
30+
rtp_path, nvim_treesitter_path
31+
)
32+
)
33+
end
34+
end
35+
'';
36+
};
37+
}

tests/test-sources/plugins/languages/treesitter/treesitter.nix

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -120,39 +120,4 @@
120120
];
121121
};
122122
};
123-
124-
combine-plugins = {
125-
performance.combinePlugins.enable = true;
126-
127-
plugins.treesitter = {
128-
enable = true;
129-
130-
# Exclude nixvim injections for test to pass
131-
nixvimInjections = false;
132-
};
133-
134-
extraConfigLuaPost = ''
135-
-- Ensure that queries from nvim-treesitter are first in rtp
136-
local queries_path = "${pkgs.vimPlugins.nvim-treesitter}/queries"
137-
for name, type in vim.fs.dir(queries_path, {depth = 10}) do
138-
if type == "file" then
139-
-- Resolve all symlinks and compare nvim-treesitter's path with
140-
-- whatever we've got from runtime
141-
local nvim_treesitter_path = assert(vim.uv.fs_realpath(vim.fs.joinpath(queries_path, name)))
142-
local rtp_path = assert(
143-
vim.uv.fs_realpath(vim.api.nvim_get_runtime_file("queries/" .. name, false)[1]),
144-
name .. " not found in runtime"
145-
)
146-
assert(
147-
nvim_treesitter_path == rtp_path,
148-
string.format(
149-
"%s from rtp (%s) is not the same as from nvim-treesitter (%s)",
150-
name,
151-
rtp_path, nvim_treesitter_path
152-
)
153-
)
154-
end
155-
end
156-
'';
157-
};
158123
}

0 commit comments

Comments
 (0)