Add test for ts syn skip cases

This commit is contained in:
Andy K. Massimino
2021-09-29 23:43:44 -04:00
parent e1e7b3afc4
commit fb5c4606ef
4 changed files with 59 additions and 1 deletions

View File

@@ -333,7 +333,7 @@ function M.attach(bufnr, lang)
local config = configs.get_module('matchup')
if opt_tbl_for_lang(config.additional_vim_regex_highlighting, lang)
and api.nvim_buf_set_option(bufnr, 'syntax') == '' then
and api.nvim_buf_get_option(bufnr, 'syntax') == '' then
api.nvim_buf_set_option(bufnr, 'syntax', 'ON')
end

View File

@@ -0,0 +1,11 @@
.PHONY: test
MYVIM ?= nvim --headless
INMAKE := 1
export INMAKE
test:
@MODE=0 $(MYVIM) -u test.vim
@MODE=1 $(MYVIM) -u test.vim
@MODE=2 $(MYVIM) -u test.vim

View File

@@ -0,0 +1,7 @@
describe '#foo' do
context 'when foo' do
it 'bars' do
expect(1).to eq(1)
end
end
end

View File

@@ -0,0 +1,40 @@
set nocompatible
source ../common/bootstrap.vim
if !$TESTS_ENABLE_TREESITTER && $MODE > 0
call matchup#test#finished()
endif
if $MODE == 1
lua <<EOF
require'nvim-treesitter.configs'.setup {
highlight = { enable = true },
matchup = { enable = true }
}
EOF
elseif $MODE == 2
lua <<EOF
require'nvim-treesitter.configs'.setup {
highlight = { enable = true },
matchup = {
enable = true,
additional_vim_regex_highlighting = true
}
}
EOF
endif
silent edit example.rb
function! s:match_test(pos, check) abort
call matchup#pos#set_cursor(a:pos)
normal %
let l:curpos = matchup#pos#get_cursor()[1:2]
call matchup#test#assert_equal(a:check, l:curpos)
endfunction
call s:match_test([7, 1], [1, 17])
call s:match_test([6, 3], [2, 22])
call s:match_test([5, 5], [3, 15])
call matchup#test#finished()