mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-18 01:38:57 +00:00
Add a tree-sitter test
This commit is contained in:
@@ -12,6 +12,19 @@ let &rtp = s:path.'/test/rtp,' . &rtp
|
||||
" load other plugins, if necessary
|
||||
" let &rtp = '~/path/to/other/plugin,' . &rtp
|
||||
|
||||
if has('nvim-0.5.0')
|
||||
let &rtp = s:path.'/test/vader/plugged/nvim-treesitter,' . &rtp
|
||||
let &rtp .= ','.s:path.'/test/vader/plugged/nvim-treesitter/after'
|
||||
|
||||
lua <<EOF
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
matchup = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
EOF
|
||||
endif
|
||||
|
||||
if empty(globpath(&rtp, 'plugin/vader.vim'))
|
||||
echoerr 'vader not found'
|
||||
exit!
|
||||
|
||||
46
test/vader/ts_py_motion.vader
Normal file
46
test/vader/ts_py_motion.vader
Normal file
@@ -0,0 +1,46 @@
|
||||
Execute (Helper):
|
||||
function! TSActive()
|
||||
return exists(':TSInstall')
|
||||
endfunction
|
||||
|
||||
if TSActive()
|
||||
Log 'nvim-treesitter active'
|
||||
else
|
||||
Log 'nvim-treesitter not active'
|
||||
endif
|
||||
|
||||
Given python (A python script):
|
||||
def F(x):
|
||||
if x == 1:
|
||||
return 1
|
||||
elif x == 2:
|
||||
pass
|
||||
else:
|
||||
return 3
|
||||
return 2
|
||||
|
||||
Execute (Logs):
|
||||
Log b:matchup_active_engines
|
||||
|
||||
Before (Cursor):
|
||||
normal! 2gg^
|
||||
|
||||
Do (Move %):
|
||||
%
|
||||
Then (Verify line):
|
||||
Assert line('.') == (TSActive() ? 4 : 2)
|
||||
|
||||
Do (Move % twice):
|
||||
%%
|
||||
Then (Verify line):
|
||||
Assert line('.') == (TSActive() ? 6 : 2)
|
||||
|
||||
Do (Move % 3 times):
|
||||
%%%
|
||||
Then (Verify line):
|
||||
Assert line('.') == (TSActive() ? 2 : 2)
|
||||
|
||||
Do (Move % 4 times):
|
||||
%%%%
|
||||
Then (Verify line):
|
||||
Assert line('.') == (TSActive() ? 4 : 2)
|
||||
Reference in New Issue
Block a user