Add a tree-sitter test

This commit is contained in:
Andy K. Massimino
2021-02-25 23:58:42 -05:00
parent 9c6e7410a3
commit 71132a93ea
4 changed files with 66 additions and 1 deletions

View File

@@ -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!

View 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)