mirror of
https://github.com/chenasraf/vim-matchup.git
synced 2026-05-17 17:38:01 +00:00
Add a new test for TS motions
This commit is contained in:
@@ -6,9 +6,27 @@ let &rtp = &rtp . ',../../../after'
|
||||
profile start /tmp/vim-profile.txt
|
||||
profile! file */matchup/*.vim
|
||||
|
||||
if has('nvim-0.5.0')
|
||||
let s:path = simplify(expand('<sfile>:h').'/../../..')
|
||||
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
|
||||
|
||||
runtime! plugin/nvim-treesitter.vim
|
||||
endif
|
||||
|
||||
filetype plugin indent on
|
||||
syntax enable
|
||||
|
||||
set notimeout
|
||||
|
||||
let g:matchup_override_vimtex = 1
|
||||
|
||||
runtime! plugin/matchup.vim
|
||||
|
||||
9
test/new/test-treesitter/Makefile
Normal file
9
test/new/test-treesitter/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
.PHONY: test
|
||||
|
||||
MYVIM ?= nvim --headless
|
||||
|
||||
INMAKE := 1
|
||||
export INMAKE
|
||||
|
||||
test:
|
||||
@$(MYVIM) -u test.vim
|
||||
13
test/new/test-treesitter/example.py
Normal file
13
test/new/test-treesitter/example.py
Normal file
@@ -0,0 +1,13 @@
|
||||
def F(x, y):
|
||||
if x == 1:
|
||||
return 1
|
||||
elif x == 2:
|
||||
if y == 5:
|
||||
pass
|
||||
elif y == 7:
|
||||
return 9
|
||||
else:
|
||||
return x
|
||||
else:
|
||||
return 3
|
||||
return 2
|
||||
5
test/new/test-treesitter/example.rb
Normal file
5
test/new/test-treesitter/example.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
unless false
|
||||
return
|
||||
else
|
||||
return
|
||||
end
|
||||
35
test/new/test-treesitter/test.vim
Normal file
35
test/new/test-treesitter/test.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
set nocompatible
|
||||
source ../common/bootstrap.vim
|
||||
|
||||
if !has('nvim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! s:assert_ts_active()
|
||||
call assert_true(index(
|
||||
\ b:matchup_active_engines.delim_all, 'tree_sitter') > -1)
|
||||
endfunction
|
||||
|
||||
" python
|
||||
silent edit example.py
|
||||
|
||||
call s:assert_ts_active()
|
||||
|
||||
0go
|
||||
norm %
|
||||
call assert_equal([3, 10], getcurpos()[1:2])
|
||||
norm 2%
|
||||
call assert_equal([10, 12], getcurpos()[1:2])
|
||||
|
||||
" ruby
|
||||
silent edit example.rb
|
||||
|
||||
call s:assert_ts_active()
|
||||
|
||||
0go
|
||||
norm %
|
||||
call assert_equal([3, 4], getcurpos()[1:2])
|
||||
norm 2%
|
||||
call assert_equal([1, 1], getcurpos()[1:2])
|
||||
|
||||
call matchup#test#finished()
|
||||
Reference in New Issue
Block a user