mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test(treesitter): skip all parsers tests if parsers aren't installed
This commit is contained in:
parent
a5ac2f45ff
commit
8336488ce1
@ -10,9 +10,11 @@ local pending_c_parser = helpers.pending_c_parser
|
|||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
describe('treesitter parser API', function()
|
describe('treesitter parser API', function()
|
||||||
|
clear()
|
||||||
|
if pending_c_parser(pending) then return end
|
||||||
|
|
||||||
it('parses buffer', function()
|
it('parses buffer', function()
|
||||||
if helpers.pending_win32(pending) or pending_c_parser(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
|
|
||||||
insert([[
|
insert([[
|
||||||
int main() {
|
int main() {
|
||||||
@ -103,8 +105,6 @@ void ui_refresh(void)
|
|||||||
}]]
|
}]]
|
||||||
|
|
||||||
it('allows to iterate over nodes children', function()
|
it('allows to iterate over nodes children', function()
|
||||||
if pending_c_parser(pending) then return end
|
|
||||||
|
|
||||||
insert(test_text);
|
insert(test_text);
|
||||||
|
|
||||||
local res = exec_lua([[
|
local res = exec_lua([[
|
||||||
@ -127,8 +127,6 @@ void ui_refresh(void)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('allows to get a child by field', function()
|
it('allows to get a child by field', function()
|
||||||
if pending_c_parser(pending) then return end
|
|
||||||
|
|
||||||
insert(test_text);
|
insert(test_text);
|
||||||
|
|
||||||
local res = exec_lua([[
|
local res = exec_lua([[
|
||||||
@ -162,8 +160,6 @@ void ui_refresh(void)
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
it("supports runtime queries", function()
|
it("supports runtime queries", function()
|
||||||
if pending_c_parser(pending) then return end
|
|
||||||
|
|
||||||
local ret = exec_lua [[
|
local ret = exec_lua [[
|
||||||
return require"vim.treesitter.query".get_query("c", "highlights").captures[1]
|
return require"vim.treesitter.query".get_query("c", "highlights").captures[1]
|
||||||
]]
|
]]
|
||||||
@ -172,8 +168,6 @@ void ui_refresh(void)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('support query and iter by capture', function()
|
it('support query and iter by capture', function()
|
||||||
if pending_c_parser(pending) then return end
|
|
||||||
|
|
||||||
insert(test_text)
|
insert(test_text)
|
||||||
|
|
||||||
local res = exec_lua([[
|
local res = exec_lua([[
|
||||||
@ -203,8 +197,6 @@ void ui_refresh(void)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('support query and iter by match', function()
|
it('support query and iter by match', function()
|
||||||
if pending_c_parser(pending) then return end
|
|
||||||
|
|
||||||
insert(test_text)
|
insert(test_text)
|
||||||
|
|
||||||
local res = exec_lua([[
|
local res = exec_lua([[
|
||||||
@ -236,8 +228,6 @@ void ui_refresh(void)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('can match special regex characters like \\ * + ( with `vim-match?`', function()
|
it('can match special regex characters like \\ * + ( with `vim-match?`', function()
|
||||||
if pending_c_parser(pending) then return end
|
|
||||||
|
|
||||||
insert('char* astring = "\\n"; (1 + 1) * 2 != 2;')
|
insert('char* astring = "\\n"; (1 + 1) * 2 != 2;')
|
||||||
|
|
||||||
local res = exec_lua([[
|
local res = exec_lua([[
|
||||||
@ -271,8 +261,6 @@ void ui_refresh(void)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('supports builtin query predicate any-of?', function()
|
it('supports builtin query predicate any-of?', function()
|
||||||
if pending_c_parser(pending) then return end
|
|
||||||
|
|
||||||
insert([[
|
insert([[
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -330,8 +318,6 @@ void ui_refresh(void)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('allow loading query with escaped quotes and capture them with `lua-match?` and `vim-match?`', function()
|
it('allow loading query with escaped quotes and capture them with `lua-match?` and `vim-match?`', function()
|
||||||
if pending_c_parser(pending) then return end
|
|
||||||
|
|
||||||
insert('char* astring = "Hello World!";')
|
insert('char* astring = "Hello World!";')
|
||||||
|
|
||||||
local res = exec_lua([[
|
local res = exec_lua([[
|
||||||
@ -407,8 +393,6 @@ void ui_refresh(void)
|
|||||||
|
|
||||||
|
|
||||||
it('allows to set simple ranges', function()
|
it('allows to set simple ranges', function()
|
||||||
if pending_c_parser(pending) then return end
|
|
||||||
|
|
||||||
insert(test_text)
|
insert(test_text)
|
||||||
|
|
||||||
local res = exec_lua [[
|
local res = exec_lua [[
|
||||||
@ -450,8 +434,6 @@ void ui_refresh(void)
|
|||||||
eq(range_tbl, { { { 0, 0, 0, 17, 1, 508 } } })
|
eq(range_tbl, { { { 0, 0, 0, 17, 1, 508 } } })
|
||||||
end)
|
end)
|
||||||
it("allows to set complex ranges", function()
|
it("allows to set complex ranges", function()
|
||||||
if pending_c_parser() then return end
|
|
||||||
|
|
||||||
insert(test_text)
|
insert(test_text)
|
||||||
|
|
||||||
local res = exec_lua [[
|
local res = exec_lua [[
|
||||||
|
Loading…
Reference in New Issue
Block a user