diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2019-04-05 00:20:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-05 00:20:44 +0200 |
| commit | 052ced4954075eca360ff7689afea82252f1c599 (patch) | |
| tree | c44bcc0ed28201e6c7ef4df93ef49c4e12a5315d /src/nvim/testdir | |
| parent | fb555c6898e8deddf6191144b18b382fa8decf99 (diff) | |
| parent | d608e9c950411611b10a52aa9d81127563cf51b4 (diff) | |
| download | rneovim-052ced4954075eca360ff7689afea82252f1c599.tar.gz rneovim-052ced4954075eca360ff7689afea82252f1c599.tar.bz2 rneovim-052ced4954075eca360ff7689afea82252f1c599.zip | |
Merge #9845 from mhinz/vim-8.1.0494
vim-patch:8.1.0{218,493,494}
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_arglist.vim | 42 | ||||
| -rw-r--r-- | src/nvim/testdir/test_match.vim | 22 |
2 files changed, 63 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index 368fc9810d..ae975fe137 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -240,13 +240,53 @@ func Test_arglistid() call assert_equal(0, arglistid()) endfunc -" Test for argv() +" Tests for argv() and argc() func Test_argv() call Reset_arglist() call assert_equal([], argv()) call assert_equal("", argv(2)) + call assert_equal(0, argc()) argadd a b c d + call assert_equal(4, argc()) call assert_equal('c', argv(2)) + + let w1_id = win_getid() + split + let w2_id = win_getid() + arglocal + args e f g + tabnew + let w3_id = win_getid() + split + let w4_id = win_getid() + argglobal + tabfirst + call assert_equal(4, argc(w1_id)) + call assert_equal('b', argv(1, w1_id)) + call assert_equal(['a', 'b', 'c', 'd'], argv(-1, w1_id)) + + call assert_equal(3, argc(w2_id)) + call assert_equal('f', argv(1, w2_id)) + call assert_equal(['e', 'f', 'g'], argv(-1, w2_id)) + + call assert_equal(3, argc(w3_id)) + call assert_equal('e', argv(0, w3_id)) + call assert_equal(['e', 'f', 'g'], argv(-1, w3_id)) + + call assert_equal(4, argc(w4_id)) + call assert_equal('c', argv(2, w4_id)) + call assert_equal(['a', 'b', 'c', 'd'], argv(-1, w4_id)) + + call assert_equal(4, argc(-1)) + call assert_equal(3, argc()) + call assert_equal('d', argv(3, -1)) + call assert_equal(['a', 'b', 'c', 'd'], argv(-1, -1)) + tabonly | only | enew! + " Negative test cases + call assert_equal(-1, argc(100)) + call assert_equal('', argv(1, 100)) + call assert_equal([], argv(-1, 100)) + call assert_equal('', argv(10, -1)) endfunc " Test for the :argedit command diff --git a/src/nvim/testdir/test_match.vim b/src/nvim/testdir/test_match.vim index e608a2e58b..e926b946a9 100644 --- a/src/nvim/testdir/test_match.vim +++ b/src/nvim/testdir/test_match.vim @@ -202,6 +202,28 @@ func Test_matchaddpos() set hlsearch& endfunc +func Test_matchaddpos_otherwin() + syntax on + new + call setline(1, ['12345', 'NP']) + let winid = win_getid() + + wincmd w + call matchadd('Search', '4', 10, -1, {'window': winid}) + call matchaddpos('Error', [[1,2], [2,2]], 10, -1, {'window': winid}) + redraw! + call assert_notequal(screenattr(1,2), 0) + call assert_notequal(screenattr(1,4), 0) + call assert_notequal(screenattr(2,2), 0) + call assert_equal(screenattr(1,2), screenattr(2,2)) + call assert_notequal(screenattr(1,2), screenattr(1,4)) + + wincmd w + bwipe! + call clearmatches() + syntax off +endfunc + func Test_matchaddpos_using_negative_priority() set hlsearch |