diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 28 | ||||
-rw-r--r-- | test/functional/ui/sign_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/ui/statuscolumn_spec.lua | 1 | ||||
-rw-r--r-- | test/old/testdir/test_signs.vim | 99 |
4 files changed, 59 insertions, 75 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 9c16f76359..b3b3128fdd 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -4680,7 +4680,7 @@ l5 screen:expect{grid=[[ {1: }^l1 | - S2S1l2 | + S1S2l2 | {1: }l3 | {1: }l4 | {1: }l5 | @@ -4720,7 +4720,7 @@ l5 screen:expect{grid=[[ {1: }^l1 | S1{1: }l2 | - S2S1l3 | + S1S2l3 | S2{1: }l4 | {1: }l5 | {1: } | @@ -4765,7 +4765,7 @@ l5 meths.buf_set_extmark(0, ns, 2, -1, {sign_text='S5'}) screen:expect{grid=[[ - S4S1^l1 | + S1S4^l1 | x S2l2 | S5{1: }l3 | {1: }l4 | @@ -4792,9 +4792,9 @@ l5 meths.buf_set_extmark(0, ns, 2, -1, {sign_text='S5'}) screen:expect{grid=[[ - S3S4S1^l1 | + S1S3S4^l1 | x S2S3l2 | - S5S3{1: }l3 | + S3S5{1: }l3 | S3{1: }l4 | S3{1: }l5 | {1: } | @@ -4848,15 +4848,15 @@ l5 end screen:expect{grid=[[ - X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | - X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | - X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | - X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | - X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | - X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | - X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | - X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | - X Y Z W {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:^h} | + W X Y Z {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | + W X Y Z {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | + W X Y Z {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | + W X Y Z {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | + W X Y Z {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | + W X Y Z {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | + W X Y Z {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | + W X Y Z {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:h} | + W X Y Z {3:a} {3:b} {3:c} {3:d} {3:e} {3:f} {3:g} {3:^h} | | ]]} end) diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua index 7dcd4cff25..31b54ce0a2 100644 --- a/test/functional/ui/sign_spec.lua +++ b/test/functional/ui/sign_spec.lua @@ -274,9 +274,9 @@ describe('Signs', function() -- Line 3 checks that with a limit over the maximum number -- of signs, the ones with the highest Ids are being picked, -- and presented by their sorted Id order. - command('sign place 4 line=3 name=pietSearch buffer=1') - command('sign place 5 line=3 name=pietWarn buffer=1') - command('sign place 3 line=3 name=pietError buffer=1') + command('sign place 6 line=3 name=pietSearch buffer=1') + command('sign place 7 line=3 name=pietWarn buffer=1') + command('sign place 5 line=3 name=pietError buffer=1') screen:expect([[ {1:>>}{8:XX}{6: 1 }a | {8:XX}{1:>>}{6: 2 }b | diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua index 9f00c7a5d6..61f6419f8c 100644 --- a/test/functional/ui/statuscolumn_spec.lua +++ b/test/functional/ui/statuscolumn_spec.lua @@ -377,6 +377,7 @@ describe('statuscolumn', function() | ]]) command('set breakindent') + command('sign unplace 2') feed('J2gjg0') screen:expect([[ {2: }{4: 0│}{1:>>}{2: }{4: }{5:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}| diff --git a/test/old/testdir/test_signs.vim b/test/old/testdir/test_signs.vim index 64271c588e..be81ed0077 100644 --- a/test/old/testdir/test_signs.vim +++ b/test/old/testdir/test_signs.vim @@ -1501,50 +1501,33 @@ func Test_sign_priority() call sign_place(3, '', 'sign3', 'Xsign', \ {'lnum' : 4, 'priority' : 20}) let s = sign_getplaced('Xsign', {'group' : '*'}) - call assert_equal([ + let se = [ \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '', \ 'priority' : 20}, \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '', \ 'priority' : 20}, \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '', - \ 'priority' : 20}], - \ s[0].signs) + \ 'priority' : 20}] + call assert_equal(se, s[0].signs) + + " Nvim: signs are always sorted lnum->priority->sign_id->last_modified + " Last modified does not take precedence over sign_id here. + " Place the last sign again with the same priority call sign_place(1, '', 'sign1', 'Xsign', \ {'lnum' : 4, 'priority' : 20}) let s = sign_getplaced('Xsign', {'group' : '*'}) - call assert_equal([ - \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '', - \ 'priority' : 20}, - \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '', - \ 'priority' : 20}, - \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '', - \ 'priority' : 20}], - \ s[0].signs) + call assert_equal(se, s[0].signs) " Place the first sign again with the same priority call sign_place(1, '', 'sign1', 'Xsign', \ {'lnum' : 4, 'priority' : 20}) let s = sign_getplaced('Xsign', {'group' : '*'}) - call assert_equal([ - \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '', - \ 'priority' : 20}, - \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '', - \ 'priority' : 20}, - \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '', - \ 'priority' : 20}], - \ s[0].signs) + call assert_equal(se, s[0].signs) " Place the middle sign again with the same priority call sign_place(3, '', 'sign3', 'Xsign', \ {'lnum' : 4, 'priority' : 20}) let s = sign_getplaced('Xsign', {'group' : '*'}) - call assert_equal([ - \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '', - \ 'priority' : 20}, - \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '', - \ 'priority' : 20}, - \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '', - \ 'priority' : 20}], - \ s[0].signs) + call assert_equal(se, s[0].signs) call sign_unplace('*') @@ -1670,34 +1653,33 @@ func Test_sign_lnum_adjust() " changes made by this function. let &g:undolevels=&g:undolevels - " Nvim: make sign adjustment when deleting lines match Vim - set signcolumn=yes:1 + " Nvim: deleting a line removes the signs along with it. - " Delete the line with the sign - call deletebufline('', 4) - let l = sign_getplaced(bufnr('')) - call assert_equal(4, l[0].signs[0].lnum) + " " Delete the line with the sign + " call deletebufline('', 4) + " let l = sign_getplaced(bufnr('')) + " call assert_equal(4, l[0].signs[0].lnum) - " Undo the delete operation - undo - let l = sign_getplaced(bufnr('')) - call assert_equal(5, l[0].signs[0].lnum) + " " Undo the delete operation + " undo + " let l = sign_getplaced(bufnr('')) + " call assert_equal(5, l[0].signs[0].lnum) - " Break the undo - let &g:undolevels=&g:undolevels + " " Break the undo + " let &g:undolevels=&g:undolevels - " Delete few lines at the end of the buffer including the line with the sign - " Sign line number should not change (as it is placed outside of the buffer) - call deletebufline('', 3, 6) - let l = sign_getplaced(bufnr('')) - call assert_equal(5, l[0].signs[0].lnum) + " " Delete few lines at the end of the buffer including the line with the sign + " " Sign line number should not change (as it is placed outside of the buffer) + " call deletebufline('', 3, 6) + " let l = sign_getplaced(bufnr('')) + " call assert_equal(5, l[0].signs[0].lnum) - " Undo the delete operation. Sign should be restored to the previous line - undo - let l = sign_getplaced(bufnr('')) - call assert_equal(5, l[0].signs[0].lnum) + " " Undo the delete operation. Sign should be restored to the previous line + " undo + " let l = sign_getplaced(bufnr('')) + " call assert_equal(5, l[0].signs[0].lnum) - set signcolumn& + " set signcolumn& sign unplace * group=* sign undefine sign1 @@ -1971,7 +1953,8 @@ func Test_sign_funcs_multi() call sign_unplace('*') " Place multiple signs at once with auto-generated sign identifier - call assert_equal([1, 1, 5], sign_placelist([ + " Nvim: next sign id is not reset and is always incremented + call assert_equal([2, 3, 4], sign_placelist([ \ {'group' : 'g1', 'name' : 'sign1', \ 'buffer' : 'Xsign', 'lnum' : 11}, \ {'group' : 'g2', 'name' : 'sign2', @@ -1980,17 +1963,17 @@ func Test_sign_funcs_multi() \ 'buffer' : 'Xsign', 'lnum' : 11}])) let s = sign_getplaced('Xsign', {'group' : '*'}) call assert_equal([ - \ {'id' : 5, 'name' : 'sign3', 'lnum' : 11, + \ {'id' : 4, 'name' : 'sign3', 'lnum' : 11, \ 'group' : '', 'priority' : 10}, - \ {'id' : 1, 'name' : 'sign2', 'lnum' : 11, + \ {'id' : 3, 'name' : 'sign2', 'lnum' : 11, \ 'group' : 'g2', 'priority' : 10}, - \ {'id' : 1, 'name' : 'sign1', 'lnum' : 11, + \ {'id' : 2, 'name' : 'sign1', 'lnum' : 11, \ 'group' : 'g1', 'priority' : 10}], s[0].signs) " Change an existing sign without specifying the group - call assert_equal([5], [{'id' : 5, 'name' : 'sign1', 'buffer' : 'Xsign'}]->sign_placelist()) - let s = sign_getplaced('Xsign', {'id' : 5, 'group' : ''}) - call assert_equal([{'id' : 5, 'name' : 'sign1', 'lnum' : 11, + call assert_equal([4], [{'id' : 4, 'name' : 'sign1', 'buffer' : 'Xsign'}]->sign_placelist()) + let s = sign_getplaced('Xsign', {'id' : 4, 'group' : ''}) + call assert_equal([{'id' : 4, 'name' : 'sign1', 'lnum' : 11, \ 'group' : '', 'priority' : 10}], s[0].signs) " Place a sign using '.' as the line number @@ -2017,8 +2000,8 @@ func Test_sign_funcs_multi() call assert_fails('call sign_placelist([100])', "E715:") " Unplace multiple signs - call assert_equal([0, 0, 0], sign_unplacelist([{'id' : 5}, - \ {'id' : 1, 'group' : 'g1'}, {'id' : 1, 'group' : 'g2'}])) + call assert_equal([0, 0, 0], sign_unplacelist([{'id' : 4}, + \ {'id' : 2, 'group' : 'g1'}, {'id' : 3, 'group' : 'g2'}])) " Invalid arguments call assert_equal([], []->sign_unplacelist()) |