mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-17 17:38:01 +00:00
Improve ts syn test
Fix
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
RANDOM := $(shell bash -c 'echo $$RANDOM')
|
||||
COVER = covimerage run --append --no-report \
|
||||
COVER = covimerage -q run --append --no-report \
|
||||
--data-file $(CURDIR)/cov.tmp/_$(RANDOM)_coverage_covimerage_$@ \
|
||||
--source $(CURDIR)/../../autoload \
|
||||
--source $(CURDIR)/../../plugin
|
||||
|
||||
@@ -9,3 +9,4 @@ test:
|
||||
@MODE=0 $(MYVIM) -u test.vim
|
||||
@MODE=1 $(MYVIM) -u test.vim
|
||||
@MODE=2 $(MYVIM) -u test.vim
|
||||
@MODE=3 $(MYVIM) -u test.vim
|
||||
|
||||
@@ -2,9 +2,12 @@ set nocompatible
|
||||
source ../common/bootstrap.vim
|
||||
|
||||
if !$TESTS_ENABLE_TREESITTER && $MODE > 0
|
||||
echo 'Exiting'
|
||||
call matchup#test#finished()
|
||||
endif
|
||||
|
||||
let s:expect_ts_engine = +$TESTS_ENABLE_TREESITTER
|
||||
|
||||
if $MODE == 1
|
||||
lua <<EOF
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
@@ -22,10 +25,36 @@ elseif $MODE == 2
|
||||
}
|
||||
}
|
||||
EOF
|
||||
elseif $MODE == 3
|
||||
lua <<EOF
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = { enable = true },
|
||||
matchup = { enable = false }
|
||||
}
|
||||
EOF
|
||||
|
||||
let s:expect_ts_engine = 0
|
||||
endif
|
||||
|
||||
silent edit example.rb
|
||||
|
||||
" manually reload match-up for the buffer since the tree-sitter
|
||||
" configuration may not have been initialized properly before
|
||||
call matchup#loader#init_buffer()
|
||||
|
||||
if s:expect_ts_engine
|
||||
call assert_equal(2, len(b:matchup_active_engines.delim_all))
|
||||
endif
|
||||
|
||||
if $MODE == 2
|
||||
call assert_false(empty(&syntax))
|
||||
endif
|
||||
|
||||
" if syntax is not available, we should use ts-based skip
|
||||
if empty(&syntax)
|
||||
call assert_true(b:matchup_delim_skip =~# 'ts_syntax')
|
||||
endif
|
||||
|
||||
function! s:match_test(pos, check) abort
|
||||
call matchup#pos#set_cursor(a:pos)
|
||||
normal %
|
||||
|
||||
Reference in New Issue
Block a user