diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-11 13:42:41 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-11 13:42:41 +0100 |
commit | 6b7b7190aa9e5c4f51bceaebf9275aa5097cfea1 (patch) | |
tree | b088f8b853ef755e35cb1336b41a660735b4124f /src/testdir/test_signs.vim | |
parent | cee9bc2e3dc5c16a9d2a8d0e23aa0d5fdefa3a4a (diff) | |
download | vim-git-6b7b7190aa9e5c4f51bceaebf9275aa5097cfea1.tar.gz |
patch 8.1.0717: there is no function for the ":sign jump" commandv8.1.0717
Problem: There is no function for the ":sign jump" command.
Solution: Add the sign_jump() function. (Yegappan Lakshmanan, closes #3780)
Diffstat (limited to 'src/testdir/test_signs.vim')
-rw-r--r-- | src/testdir/test_signs.vim | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/testdir/test_signs.vim b/src/testdir/test_signs.vim index 07547bb2b..5962ab534 100644 --- a/src/testdir/test_signs.vim +++ b/src/testdir/test_signs.vim @@ -1255,3 +1255,48 @@ func Test_sign_change_type() sign undefine sign2 enew! endfunc + +" Test for the sign_jump() function +func Test_sign_jump_func() + enew! | only! + + sign define sign1 text=#> linehl=Comment + + edit foo + set buftype=nofile + call setline(1, ['A', 'B', 'C', 'D', 'E']) + call sign_place(5, '', 'sign1', '', {'lnum' : 2}) + call sign_place(5, 'g1', 'sign1', '', {'lnum' : 3}) + call sign_place(6, '', 'sign1', '', {'lnum' : 4}) + call sign_place(6, 'g1', 'sign1', '', {'lnum' : 5}) + split bar + set buftype=nofile + call setline(1, ['P', 'Q', 'R', 'S', 'T']) + call sign_place(5, '', 'sign1', '', {'lnum' : 2}) + call sign_place(5, 'g1', 'sign1', '', {'lnum' : 3}) + call sign_place(6, '', 'sign1', '', {'lnum' : 4}) + call sign_place(6, 'g1', 'sign1', '', {'lnum' : 5}) + + let r = sign_jump(5, '', 'foo') + call assert_equal(2, r) + call assert_equal(2, line('.')) + let r = sign_jump(6, 'g1', 'foo') + call assert_equal(5, r) + call assert_equal(5, line('.')) + let r = sign_jump(5, '', 'bar') + call assert_equal(2, r) + call assert_equal(2, line('.')) + + " Error cases + call assert_fails("call sign_jump(99, '', 'bar')", 'E157:') + call assert_fails("call sign_jump(0, '', 'foo')", 'E474:') + call assert_fails("call sign_jump(5, 'g5', 'foo')", 'E157:') + call assert_fails('call sign_jump([], "", "foo")', 'E745:') + call assert_fails('call sign_jump(2, [], "foo")', 'E730:') + call assert_fails('call sign_jump(2, "", {})', 'E158:') + call assert_fails('call sign_jump(2, "", "baz")', 'E158:') + + sign unplace * group=* + sign undefine sign1 + enew! | only! +endfunc |