diff --git a/autoload/matchup/test.vim b/autoload/matchup/test.vim index 769ec70..fb58d85 100644 --- a/autoload/matchup/test.vim +++ b/autoload/matchup/test.vim @@ -4,6 +4,24 @@ " Email: a@normed.space " +function! matchup#test#finished() abort " {{{1 + for l:error in v:errors + let l:match = matchlist(l:error, '\(.*\) line \(\d\+\): \(.*\)') + let l:file = fnamemodify(l:match[1], ':.') + let l:lnum = l:match[2] + let l:msg = l:match[3] + echo printf("%s:%d: %s\n", l:file, l:lnum, l:msg) + endfor + + if len(v:errors) > 0 + cquit + else + quitall! + endif +endfunction + +" }}}1 + function! matchup#test#assert(condition) abort " {{{1 if a:condition | return 1 | endif diff --git a/test/new/common/bootstrap.vim b/test/new/common/bootstrap.vim index 1690469..ea68611 100644 --- a/test/new/common/bootstrap.vim +++ b/test/new/common/bootstrap.vim @@ -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(':h').'/../../..') + let &rtp = s:path.'/test/vader/plugged/nvim-treesitter,' . &rtp + let &rtp .= ','.s:path.'/test/vader/plugged/nvim-treesitter/after' + + lua < -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()