annotate src/testdir/test_signs.vim @ 15621:bfbdef46aa7d v8.1.0818

patch 8.1.0818: MS-Windows: cannot send large data with ch_sendraw() commit https://github.com/vim/vim/commit/240583869ae477202494dd01ef1e8e2bac650f10 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 24 23:11:49 2019 +0100 patch 8.1.0818: MS-Windows: cannot send large data with ch_sendraw() Problem: MS-Windows: cannot send large data with ch_sendraw(). Solution: Split write into several WriteFile() calls. (Yasuhiro Matsumoto, closes #3823)
author Bram Moolenaar <Bram@vim.org>
date Thu, 24 Jan 2019 23:15:05 +0100
parents 89e76a598b30
children 9e0154efac3a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for signs
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has('signs')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 finish
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endif
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_sign()
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 new
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call setline(1, ['a', 'b', 'c', 'd'])
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
11 " Define some signs.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
12 " We can specify icons even if not all versions of vim support icons as
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
13 " icon is ignored when not supported. "(not supported)" is shown after
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
14 " the icon name when listing signs.
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 sign define Sign1 text=x
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
16 try
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
17 sign define Sign2 text=xy texthl=Title linehl=Error
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
18 \ icon=../../pixmaps/stock_vim_find_help.png
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
19 catch /E255:/
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
20 " Ignore error: E255: Couldn't read in sign data!
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
21 " This error can happen when running in the GUI.
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
22 " Some gui like Motif do not support the png icon format.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
23 endtry
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " Test listing signs.
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 let a=execute('sign list')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
27 call assert_match('^\nsign Sign1 text=x \nsign Sign2 ' .
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
28 \ 'icon=../../pixmaps/stock_vim_find_help.png .*text=xy ' .
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
29 \ 'linehl=Error texthl=Title$', a)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 let a=execute('sign list Sign1')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal("\nsign Sign1 text=x ", a)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
34 " Split the window to the bottom to verify sign jump will stay in the
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
35 " current window if the buffer is displayed there.
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
36 let bn = bufnr('%')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
37 let wn = winnr()
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
38 exe 'sign place 41 line=3 name=Sign1 buffer=' . bn
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 1
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
40 bot split
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
41 exe 'sign jump 41 buffer=' . bufnr('%')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
42 call assert_equal('c', getline('.'))
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
43 call assert_equal(3, winnr())
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
44 call assert_equal(bn, bufnr('%'))
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
45 call assert_notequal(wn, winnr())
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
46
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
47 " Create a new buffer and check that ":sign jump" switches to the old buffer.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
48 1
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
49 new foo
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
50 call assert_notequal(bn, bufnr('%'))
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
51 exe 'sign jump 41 buffer=' . bn
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
52 call assert_equal(bn, bufnr('%'))
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_equal('c', getline('.'))
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
55 " Redraw to make sure that screen redraw with sign gets exercised,
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
56 " with and without 'rightleft'.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
57 if has('rightleft')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
58 set rightleft
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
59 redraw
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
60 set norightleft
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
61 endif
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
62 redraw
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
64 " Check that we can't change sign.
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
65 call assert_fails("sign place 40 name=Sign1 buffer=" . bufnr('%'), 'E885:')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
66
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
67 " Check placed signs
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 let a=execute('sign place')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
69 call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
70 \ " line=3 id=41 name=Sign1 priority=10\n", a)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
72 " Unplace the sign and try jumping to it again should fail.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
73 sign unplace 41
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 1
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
75 call assert_fails("sign jump 41 buffer=" . bufnr('%'), 'E157:')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 call assert_equal('a', getline('.'))
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 " Unplace sign on current line.
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
79 exe 'sign place 42 line=4 name=Sign2 buffer=' . bufnr('%')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 4
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 sign unplace
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 let a=execute('sign place')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal("\n--- Signs ---\n", a)
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
84
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 " Try again to unplace sign on current line, it should fail this time.
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call assert_fails('sign unplace', 'E159:')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 " Unplace all signs.
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
89 exe 'sign place 41 line=3 name=Sign1 buffer=' . bufnr('%')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 sign unplace *
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 let a=execute('sign place')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 call assert_equal("\n--- Signs ---\n", a)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
94 " Place a sign without specifying the filename or buffer
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
95 sign place 77 line=9 name=Sign2
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
96 let a=execute('sign place')
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
97 call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
98 \ " line=9 id=77 name=Sign2 priority=10\n", a)
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
99 sign unplace *
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
100
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
101 " Check :jump with file=...
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
102 edit foo
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
103 call setline(1, ['A', 'B', 'C', 'D'])
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
104
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
105 try
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
106 sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
107 \ icon=doesnotexist.xpm
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
108 catch /E255:/
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
109 " ignore error: E255: it can happens for guis.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
110 endtry
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
111
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
112 let fn = expand('%:p')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
113 exe 'sign place 43 line=2 name=Sign3 file=' . fn
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
114 edit bar
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
115 call assert_notequal(fn, expand('%:p'))
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
116 exe 'sign jump 43 file=' . fn
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
117 call assert_equal('B', getline('.'))
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
118
15322
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
119 " Check for jumping to a sign in a hidden buffer
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
120 enew! | only!
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
121 edit foo
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
122 call setline(1, ['A', 'B', 'C', 'D'])
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
123 let fn = expand('%:p')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
124 exe 'sign place 21 line=3 name=Sign3 file=' . fn
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
125 hide edit bar
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
126 exe 'sign jump 21 file=' . fn
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
127 call assert_equal('C', getline('.'))
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
128
15156
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
129 " can't define a sign with a non-printable character as text
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
130 call assert_fails("sign define Sign4 text=\e linehl=Comment", 'E239:')
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
131 call assert_fails("sign define Sign4 text=a\e linehl=Comment", 'E239:')
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
132 call assert_fails("sign define Sign4 text=\ea linehl=Comment", 'E239:')
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
133
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
134 " Only 1 or 2 character text is allowed
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
135 call assert_fails("sign define Sign4 text=abc linehl=Comment", 'E239:')
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
136 call assert_fails("sign define Sign4 text= linehl=Comment", 'E239:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
137 call assert_fails("sign define Sign4 text=\\ ab linehl=Comment", 'E239:')
15156
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
138
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
139 " define sign with whitespace
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
140 sign define Sign4 text=\ X linehl=Comment
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
141 sign undefine Sign4
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
142 sign define Sign4 linehl=Comment text=\ X
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
143 sign undefine Sign4
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
144
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
145 sign define Sign5 text=X\ linehl=Comment
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
146 sign undefine Sign5
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
147 sign define Sign5 linehl=Comment text=X\
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
148 sign undefine Sign5
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
149
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
150 " define sign with backslash
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
151 sign define Sign4 text=\\\\ linehl=Comment
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
152 sign undefine Sign4
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
153 sign define Sign4 text=\\ linehl=Comment
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
154 sign undefine Sign4
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
155
15322
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
156 " define a sign with a leading 0 in the name
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
157 sign unplace *
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
158 sign define 004 text=#> linehl=Comment
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
159 let a = execute('sign list 4')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
160 call assert_equal("\nsign 4 text=#> linehl=Comment", a)
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
161 exe 'sign place 20 line=3 name=004 buffer=' . bufnr('')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
162 let a = execute('sign place')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
163 call assert_equal("\n--- Signs ---\nSigns for foo:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
164 \ " line=3 id=20 name=4 priority=10\n", a)
15322
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
165 exe 'sign unplace 20 buffer=' . bufnr('')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
166 sign undefine 004
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
167 call assert_fails('sign list 4', 'E155:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
168
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 " After undefining the sign, we should no longer be able to place it.
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 sign undefine Sign1
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 sign undefine Sign2
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
172 sign undefine Sign3
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
173 call assert_fails("sign place 41 line=3 name=Sign1 buffer=" .
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
174 \ bufnr('%'), 'E155:')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
175 endfunc
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
177 " Undefining placed sign is not recommended.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
178 " Quoting :help sign
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
179 "
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
180 " :sign undefine {name}
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
181 " Deletes a previously defined sign. If signs with this {name}
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
182 " are still placed this will cause trouble.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
183 func Test_sign_undefine_still_placed()
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
184 new foobar
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
185 sign define Sign text=x
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
186 exe 'sign place 41 line=1 name=Sign buffer=' . bufnr('%')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
187 sign undefine Sign
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
188
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
189 " Listing placed sign should show that sign is deleted.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
190 let a=execute('sign place')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
191 call assert_equal("\n--- Signs ---\nSigns for foobar:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
192 \ " line=1 id=41 name=[Deleted] priority=10\n", a)
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
193
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
194 sign unplace 41
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
195 let a=execute('sign place')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
196 call assert_equal("\n--- Signs ---\n", a)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 endfunc
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 func Test_sign_completion()
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 sign define Sign1 text=x
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 sign define Sign2 text=y
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 call feedkeys(":sign \<C-A>\<C-B>\"\<CR>", 'tx')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 call assert_equal('"sign define jump list place undefine unplace', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 call feedkeys(":sign define Sign \<C-A>\<C-B>\"\<CR>", 'tx')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 call assert_equal('"sign define Sign icon= linehl= text= texthl=', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 call feedkeys(":sign define Sign linehl=Spell\<C-A>\<C-B>\"\<CR>", 'tx')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
210 call assert_equal('"sign define Sign linehl=SpellBad SpellCap ' .
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
211 \ 'SpellLocal SpellRare', @:)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212
10044
46e630ac4380 commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents: 9902
diff changeset
213 call writefile(['foo'], 'XsignOne')
46e630ac4380 commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents: 9902
diff changeset
214 call writefile(['bar'], 'XsignTwo')
46e630ac4380 commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents: 9902
diff changeset
215 call feedkeys(":sign define Sign icon=Xsig\<C-A>\<C-B>\"\<CR>", 'tx')
46e630ac4380 commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents: 9902
diff changeset
216 call assert_equal('"sign define Sign icon=XsignOne XsignTwo', @:)
46e630ac4380 commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents: 9902
diff changeset
217 call delete('XsignOne')
46e630ac4380 commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents: 9902
diff changeset
218 call delete('XsignTwo')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
219
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 call feedkeys(":sign undefine \<C-A>\<C-B>\"\<CR>", 'tx')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 call assert_equal('"sign undefine Sign1 Sign2', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 call feedkeys(":sign place 1 \<C-A>\<C-B>\"\<CR>", 'tx')
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
224 call assert_equal('"sign place 1 buffer= file= group= line= name= priority=',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
225 \ @:)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 call feedkeys(":sign place 1 name=\<C-A>\<C-B>\"\<CR>", 'tx')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 call assert_equal('"sign place 1 name=Sign1 Sign2', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 call feedkeys(":sign unplace 1 \<C-A>\<C-B>\"\<CR>", 'tx')
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
231 call assert_equal('"sign unplace 1 buffer= file= group=', @:)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 call feedkeys(":sign list \<C-A>\<C-B>\"\<CR>", 'tx')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 call assert_equal('"sign list Sign1 Sign2', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 call feedkeys(":sign jump 1 \<C-A>\<C-B>\"\<CR>", 'tx')
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
237 call assert_equal('"sign jump 1 buffer= file= group=', @:)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 sign undefine Sign1
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 sign undefine Sign2
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 endfunc
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 func Test_sign_invalid_commands()
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
244 sign define Sign1 text=x
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
245
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 call assert_fails('sign', 'E471:')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
247 call assert_fails('sign jump', 'E471:')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 call assert_fails('sign xxx', 'E160:')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 call assert_fails('sign define', 'E156:')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
250 call assert_fails('sign define Sign1 xxx', 'E475:')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 call assert_fails('sign undefine', 'E156:')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 call assert_fails('sign list xxx', 'E155:')
12692
03a6aeea2096 patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents: 10044
diff changeset
253 call assert_fails('sign place 1 buffer=999', 'E158:')
15322
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
254 call assert_fails('sign place 1 name=Sign1 buffer=999', 'E158:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
255 call assert_fails('sign place buffer=999', 'E158:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
256 call assert_fails('sign jump buffer=999', 'E158:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
257 call assert_fails('sign jump 1 file=', 'E158:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
258 call assert_fails('sign jump 1 group=', 'E474:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
259 call assert_fails('sign jump 1 name=', 'E474:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
260 call assert_fails('sign jump 1 name=Sign1', 'E474:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
261 call assert_fails('sign jump 1 line=100', '474:')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 call assert_fails('sign define Sign2 text=', 'E239:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
263 " Non-numeric identifier for :sign place
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
264 call assert_fails("sign place abc line=3 name=Sign1 buffer=" . bufnr(''),
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
265 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
266 " Non-numeric identifier for :sign unplace
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
267 call assert_fails("sign unplace abc name=Sign1 buffer=" . bufnr(''),
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
268 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
269 " Number followed by an alphabet as sign identifier for :sign place
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
270 call assert_fails("sign place 1abc line=3 name=Sign1 buffer=" . bufnr(''),
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
271 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
272 " Number followed by an alphabet as sign identifier for :sign unplace
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
273 call assert_fails("sign unplace 2abc name=Sign1 buffer=" . bufnr(''),
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
274 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
275 " Sign identifier and '*' for :sign unplace
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
276 call assert_fails("sign unplace 2 *", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
277 " Trailing characters after buffer number for :sign place
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
278 call assert_fails("sign place 1 line=3 name=Sign1 buffer=" .
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
279 \ bufnr('%') . 'xxx', 'E488:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
280 " Trailing characters after buffer number for :sign unplace
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
281 call assert_fails("sign unplace 1 buffer=" . bufnr('%') . 'xxx', 'E488:')
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
282 call assert_fails("sign unplace * buffer=" . bufnr('%') . 'xxx', 'E488:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
283 call assert_fails("sign unplace 1 xxx", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
284 call assert_fails("sign unplace * xxx", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
285 call assert_fails("sign unplace xxx", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
286 " Placing a sign without line number
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
287 call assert_fails("sign place name=Sign1 buffer=" . bufnr('%'), 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
288 " Placing a sign without sign name
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
289 call assert_fails("sign place line=10 buffer=" . bufnr('%'), 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
290 " Unplacing a sign with line number
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
291 call assert_fails("sign unplace 2 line=10 buffer=" . bufnr('%'), 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
292 " Unplacing a sign with sign name
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
293 call assert_fails("sign unplace 2 name=Sign1 buffer=" . bufnr('%'), 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
294 " Placing a sign without sign name
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
295 call assert_fails("sign place 2 line=3 buffer=" . bufnr('%'), 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
296 " Placing a sign with only sign identifier
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
297 call assert_fails("sign place 2", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
298 " Placing a sign with only a name
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
299 call assert_fails("sign place abc", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
300 " Placing a sign with only line number
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
301 call assert_fails("sign place 5 line=3", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
302 " Placing a sign with only sign group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
303 call assert_fails("sign place 5 group=g1", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
304 call assert_fails("sign place 5 group=*", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
305 " Placing a sign with only sign priority
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
306 call assert_fails("sign place 5 priority=10", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
307
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
308 sign undefine Sign1
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309 endfunc
9902
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
310
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
311 func Test_sign_delete_buffer()
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
312 new
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
313 sign define Sign text=x
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
314 let bufnr = bufnr('%')
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
315 new
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
316 exe 'bd ' . bufnr
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
317 exe 'sign place 61 line=3 name=Sign buffer=' . bufnr
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
318 call assert_fails('sign jump 61 buffer=' . bufnr, 'E934:')
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
319 sign unplace 61
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
320 sign undefine Sign
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
321 endfunc
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
322
15271
a6319aca721b patch 8.1.0644: finding next sign ID is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15247
diff changeset
323 " Test for Vim script functions for managing signs
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
324 func Test_sign_funcs()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
325 " Remove all the signs
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
326 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
327 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
328
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
329 " Tests for sign_define()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
330 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
331 call assert_equal(0, sign_define("sign1", attr))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
332 call assert_equal([{'name' : 'sign1', 'texthl' : 'Error',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
333 \ 'linehl' : 'Search', 'text' : '=>'}], sign_getdefined())
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
334
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
335 " Define a new sign without attributes and then update it
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
336 call sign_define("sign2")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
337 let attr = {'text' : '!!', 'linehl' : 'DiffAdd', 'texthl' : 'DiffChange',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
338 \ 'icon' : 'sign2.ico'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
339 try
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
340 call sign_define("sign2", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
341 catch /E255:/
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
342 " ignore error: E255: Couldn't read in sign data!
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
343 " This error can happen when running in gui.
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
344 endtry
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
345 call assert_equal([{'name' : 'sign2', 'texthl' : 'DiffChange',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
346 \ 'linehl' : 'DiffAdd', 'text' : '!!', 'icon' : 'sign2.ico'}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
347 \ sign_getdefined("sign2"))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
348
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
349 " Test for a sign name with digits
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
350 call assert_equal(0, sign_define(0002, {'linehl' : 'StatusLine'}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
351 call assert_equal([{'name' : '2', 'linehl' : 'StatusLine'}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
352 \ sign_getdefined(0002))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
353 call sign_undefine(0002)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
354
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
355 " Tests for invalid arguments to sign_define()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
356 call assert_fails('call sign_define("sign4", {"text" : "===>"})', 'E239:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
357 call assert_fails('call sign_define("sign5", {"text" : ""})', 'E239:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
358 call assert_fails('call sign_define([])', 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
359 call assert_fails('call sign_define("sign6", [])', 'E715:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
360
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
361 " Tests for sign_getdefined()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
362 call assert_equal([], sign_getdefined("none"))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
363 call assert_fails('call sign_getdefined({})', 'E731:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
364
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
365 " Tests for sign_place()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
366 call writefile(repeat(["Sun is shining"], 30), "Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
367 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
368
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
369 call assert_equal(10, sign_place(10, '', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
370 \ {'lnum' : 20}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
371 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
372 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
373 \ 'priority' : 10}]}], sign_getplaced('Xsign'))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
374 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
375 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
376 \ 'priority' : 10}]}],
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
377 \ sign_getplaced('%', {'lnum' : 20}))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
378 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
379 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
380 \ 'priority' : 10}]}],
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
381 \ sign_getplaced('', {'id' : 10}))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
382
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
383 " Tests for invalid arguments to sign_place()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
384 call assert_fails('call sign_place([], "", "mySign", 1)', 'E745:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
385 call assert_fails('call sign_place(5, "", "mySign", -1)', 'E158:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
386 call assert_fails('call sign_place(-1, "", "sign1", "Xsign", [])',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
387 \ 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
388 call assert_fails('call sign_place(-1, "", "sign1", "Xsign",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
389 \ {"lnum" : 30})', 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
390 call assert_fails('call sign_place(10, "", "xsign1x", "Xsign",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
391 \ {"lnum" : 30})', 'E155:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
392 call assert_fails('call sign_place(10, "", "", "Xsign",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
393 \ {"lnum" : 30})', 'E155:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
394 call assert_fails('call sign_place(10, "", [], "Xsign",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
395 \ {"lnum" : 30})', 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
396 call assert_fails('call sign_place(5, "", "sign1", "abcxyz.xxx",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
397 \ {"lnum" : 10})', 'E158:')
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
398 call assert_fails('call sign_place(5, "", "sign1", "@", {"lnum" : 10})',
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
399 \ 'E158:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
400 call assert_fails('call sign_place(5, "", "sign1", [], {"lnum" : 10})',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
401 \ 'E158:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
402 call assert_fails('call sign_place(21, "", "sign1", "Xsign",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
403 \ {"lnum" : -1})', 'E885:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
404 call assert_fails('call sign_place(22, "", "sign1", "Xsign",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
405 \ {"lnum" : 0})', 'E885:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
406 call assert_fails('call sign_place(22, "", "sign1", "Xsign",
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
407 \ {"lnum" : []})', 'E745:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
408 call assert_equal(-1, sign_place(1, "*", "sign1", "Xsign", {"lnum" : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
409
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
410 " Tests for sign_getplaced()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
411 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
412 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
413 \ 'priority' : 10}]}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
414 \ sign_getplaced(bufnr('Xsign')))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
415 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
416 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
417 \ 'priority' : 10}]}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
418 \ sign_getplaced())
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
419 call assert_fails("call sign_getplaced('dummy.sign')", 'E158:')
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
420 call assert_fails('call sign_getplaced("&")', 'E158:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
421 call assert_fails('call sign_getplaced(-1)', 'E158:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
422 call assert_fails('call sign_getplaced("Xsign", [])', 'E715:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
423 call assert_equal([{'bufnr' : bufnr(''), 'signs' : []}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
424 \ sign_getplaced('Xsign', {'lnum' : 1000000}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
425 call assert_fails("call sign_getplaced('Xsign', {'lnum' : []})",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
426 \ 'E745:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
427 call assert_equal([{'bufnr' : bufnr(''), 'signs' : []}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
428 \ sign_getplaced('Xsign', {'id' : 44}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
429 call assert_fails("call sign_getplaced('Xsign', {'id' : []})",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
430 \ 'E745:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
431
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
432 " Tests for sign_unplace()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
433 call sign_place(20, '', 'sign2', 'Xsign', {"lnum" : 30})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
434 call assert_equal(0, sign_unplace('',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
435 \ {'id' : 20, 'buffer' : 'Xsign'}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
436 call assert_equal(-1, sign_unplace('',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
437 \ {'id' : 30, 'buffer' : 'Xsign'}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
438 call sign_place(20, '', 'sign2', 'Xsign', {"lnum" : 30})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
439 call assert_fails("call sign_unplace('',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
440 \ {'id' : 20, 'buffer' : 'buffer.c'})", 'E158:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
441 call assert_fails("call sign_unplace('',
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
442 \ {'id' : 20, 'buffer' : '&'})", 'E158:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
443 call assert_fails("call sign_unplace('g1',
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
444 \ {'id' : 20, 'buffer' : 200})", 'E158:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
445 call assert_fails("call sign_unplace('g1', 'mySign')", 'E715:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
446
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
447 " Tests for sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
448 call assert_equal(0, sign_undefine("sign1"))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
449 call assert_equal([], sign_getdefined("sign1"))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
450 call assert_fails('call sign_undefine("none")', 'E155:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
451 call assert_fails('call sign_undefine([])', 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
452
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
453 call delete("Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
454 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
455 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
456 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
457 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
458
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
459 " Tests for sign groups
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
460 func Test_sign_group()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
461 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
462 " Remove all the signs
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
463 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
464 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
465
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
466 call writefile(repeat(["Sun is shining"], 30), "Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
467
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
468 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
469 call assert_equal(0, sign_define("sign1", attr))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
470
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
471 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
472 let bnum = bufnr('%')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
473
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
474 " Error case
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
475 call assert_fails("call sign_place(5, [], 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
476 \ {'lnum' : 30})", 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
477
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
478 " place three signs with the same identifier. One in the global group and
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
479 " others in the named groups
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
480 call assert_equal(5, sign_place(5, '', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
481 \ {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
482 call assert_equal(5, sign_place(5, 'g1', 'sign1', bnum, {'lnum' : 20}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
483 call assert_equal(5, sign_place(5, 'g2', 'sign1', bnum, {'lnum' : 30}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
484
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
485 " Test for sign_getplaced() with group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
486 let s = sign_getplaced('Xsign')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
487 call assert_equal(1, len(s[0].signs))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
488 call assert_equal(s[0].signs[0].group, '')
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
489 let s = sign_getplaced(bnum, {'group' : ''})
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
490 call assert_equal([{'id' : 5, 'group' : '', 'name' : 'sign1', 'lnum' : 10,
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
491 \ 'priority' : 10}], s[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
492 call assert_equal(1, len(s[0].signs))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
493 let s = sign_getplaced(bnum, {'group' : 'g2'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
494 call assert_equal('g2', s[0].signs[0].group)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
495 let s = sign_getplaced(bnum, {'group' : 'g3'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
496 call assert_equal([], s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
497 let s = sign_getplaced(bnum, {'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
498 call assert_equal([{'id' : 5, 'group' : '', 'name' : 'sign1', 'lnum' : 10,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
499 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
500 \ {'id' : 5, 'group' : 'g1', 'name' : 'sign1', 'lnum' : 20,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
501 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
502 \ {'id' : 5, 'group' : 'g2', 'name' : 'sign1', 'lnum' : 30,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
503 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
504 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
505
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
506 " Test for sign_getplaced() with id
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
507 let s = sign_getplaced(bnum, {'id' : 5})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
508 call assert_equal([{'id' : 5, 'group' : '', 'name' : 'sign1', 'lnum' : 10,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
509 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
510 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
511 let s = sign_getplaced(bnum, {'id' : 5, 'group' : 'g2'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
512 call assert_equal(
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
513 \ [{'id' : 5, 'name' : 'sign1', 'lnum' : 30, 'group' : 'g2',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
514 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
515 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
516 let s = sign_getplaced(bnum, {'id' : 5, 'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
517 call assert_equal([{'id' : 5, 'group' : '', 'name' : 'sign1', 'lnum' : 10,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
518 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
519 \ {'id' : 5, 'group' : 'g1', 'name' : 'sign1', 'lnum' : 20,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
520 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
521 \ {'id' : 5, 'group' : 'g2', 'name' : 'sign1', 'lnum' : 30,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
522 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
523 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
524 let s = sign_getplaced(bnum, {'id' : 5, 'group' : 'g3'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
525 call assert_equal([], s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
526
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
527 " Test for sign_getplaced() with lnum
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
528 let s = sign_getplaced(bnum, {'lnum' : 20})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
529 call assert_equal([], s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
530 let s = sign_getplaced(bnum, {'lnum' : 20, 'group' : 'g1'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
531 call assert_equal(
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
532 \ [{'id' : 5, 'name' : 'sign1', 'lnum' : 20, 'group' : 'g1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
533 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
534 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
535 let s = sign_getplaced(bnum, {'lnum' : 30, 'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
536 call assert_equal(
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
537 \ [{'id' : 5, 'name' : 'sign1', 'lnum' : 30, 'group' : 'g2',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
538 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
539 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
540 let s = sign_getplaced(bnum, {'lnum' : 40, 'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
541 call assert_equal([], s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
542
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
543 " Error case
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
544 call assert_fails("call sign_getplaced(bnum, {'group' : []})",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
545 \ 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
546
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
547 " Clear the sign in global group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
548 call sign_unplace('', {'id' : 5, 'buffer' : bnum})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
549 let s = sign_getplaced(bnum, {'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
550 call assert_equal([
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
551 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 20, 'group' : 'g1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
552 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
553 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 30, 'group' : 'g2',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
554 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
555 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
556
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
557 " Clear the sign in one of the groups
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
558 call sign_unplace('g1', {'buffer' : 'Xsign'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
559 let s = sign_getplaced(bnum, {'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
560 call assert_equal([
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
561 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 30, 'group' : 'g2',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
562 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
563 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
564
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
565 " Clear all the signs from the buffer
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
566 call sign_unplace('*', {'buffer' : bnum})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
567 call assert_equal([], sign_getplaced(bnum, {'group' : '*'})[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
568
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
569 " Clear sign across groups using an identifier
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
570 call sign_place(25, '', 'sign1', bnum, {'lnum' : 10})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
571 call sign_place(25, 'g1', 'sign1', bnum, {'lnum' : 11})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
572 call sign_place(25, 'g2', 'sign1', bnum, {'lnum' : 12})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
573 call assert_equal(0, sign_unplace('*', {'id' : 25}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
574 call assert_equal([], sign_getplaced(bnum, {'group' : '*'})[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
575
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
576 " Error case
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
577 call assert_fails("call sign_unplace([])", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
578
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
579 " Place a sign in the global group and try to delete it using a group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
580 call assert_equal(5, sign_place(5, '', 'sign1', bnum, {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
581 call assert_equal(-1, sign_unplace('g1', {'id' : 5}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
582
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
583 " Place signs in multiple groups and delete all the signs in one of the
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
584 " group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
585 call assert_equal(5, sign_place(5, '', 'sign1', bnum, {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
586 call assert_equal(6, sign_place(6, '', 'sign1', bnum, {'lnum' : 11}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
587 call assert_equal(5, sign_place(5, 'g1', 'sign1', bnum, {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
588 call assert_equal(5, sign_place(5, 'g2', 'sign1', bnum, {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
589 call assert_equal(6, sign_place(6, 'g1', 'sign1', bnum, {'lnum' : 11}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
590 call assert_equal(6, sign_place(6, 'g2', 'sign1', bnum, {'lnum' : 11}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
591 call assert_equal(0, sign_unplace('g1'))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
592 let s = sign_getplaced(bnum, {'group' : 'g1'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
593 call assert_equal([], s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
594 let s = sign_getplaced(bnum)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
595 call assert_equal(2, len(s[0].signs))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
596 let s = sign_getplaced(bnum, {'group' : 'g2'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
597 call assert_equal('g2', s[0].signs[0].group)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
598 call assert_equal(0, sign_unplace('', {'id' : 5}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
599 call assert_equal(0, sign_unplace('', {'id' : 6}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
600 let s = sign_getplaced(bnum, {'group' : 'g2'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
601 call assert_equal('g2', s[0].signs[0].group)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
602 call assert_equal(0, sign_unplace('', {'buffer' : bnum}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
603
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
604 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
605
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
606 " Test for :sign command and groups
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
607 sign place 5 line=10 name=sign1 file=Xsign
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
608 sign place 5 group=g1 line=10 name=sign1 file=Xsign
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
609 sign place 5 group=g2 line=10 name=sign1 file=Xsign
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
610
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
611 " Tests for the ':sign place' command
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
612
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
613 " :sign place file={fname}
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
614 let a = execute('sign place file=Xsign')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
615 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
616 \ " line=10 id=5 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
617
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
618 " :sign place group={group} file={fname}
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
619 let a = execute('sign place group=g2 file=Xsign')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
620 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
621 \ " line=10 id=5 group=g2 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
622
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
623 " :sign place group=* file={fname}
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
624 let a = execute('sign place group=* file=Xsign')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
625 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
626 \ " line=10 id=5 group=g2 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
627 \ " line=10 id=5 group=g1 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
628 \ " line=10 id=5 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
629
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
630 " Error case: non-existing group
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
631 let a = execute('sign place group=xyz file=Xsign')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
632 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n", a)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
633
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
634 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
635 let bnum = bufnr('Xsign')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
636 exe 'sign place 5 line=10 name=sign1 buffer=' . bnum
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
637 exe 'sign place 5 group=g1 line=11 name=sign1 buffer=' . bnum
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
638 exe 'sign place 5 group=g2 line=12 name=sign1 buffer=' . bnum
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
639
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
640 " :sign place buffer={fname}
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
641 let a = execute('sign place buffer=' . bnum)
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
642 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
643 \ " line=10 id=5 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
644
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
645 " :sign place group={group} buffer={fname}
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
646 let a = execute('sign place group=g2 buffer=' . bnum)
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
647 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
648 \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
649
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
650 " :sign place group=* buffer={fname}
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
651 let a = execute('sign place group=* buffer=' . bnum)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
652 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
653 \ " line=10 id=5 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
654 \ " line=11 id=5 group=g1 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
655 \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
656
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
657 " Error case: non-existing group
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
658 let a = execute('sign place group=xyz buffer=' . bnum)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
659 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n", a)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
660
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
661 " :sign place
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
662 let a = execute('sign place')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
663 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
664 \ " line=10 id=5 name=sign1 priority=10\n", a)
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
665
15388
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
666 " Place signs in more than one buffer and list the signs
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
667 split foo
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
668 set buftype=nofile
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
669 sign place 25 line=76 name=sign1 priority=99 file=foo
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
670 let a = execute('sign place')
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
671 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
672 \ " line=10 id=5 name=sign1 priority=10\n" .
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
673 \ "Signs for foo:\n" .
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
674 \ " line=76 id=25 name=sign1 priority=99\n", a)
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
675 close
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
676 bwipe foo
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
677
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
678 " :sign place group={group}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
679 let a = execute('sign place group=g1')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
680 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
681 \ " line=11 id=5 group=g1 name=sign1 priority=10\n", a)
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
682
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
683 " :sign place group=*
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
684 let a = execute('sign place group=*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
685 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
686 \ " line=10 id=5 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
687 \ " line=11 id=5 group=g1 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
688 \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
689
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
690 " Test for ':sign jump' command with groups
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
691 sign jump 5 group=g1 file=Xsign
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
692 call assert_equal(11, line('.'))
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
693 call assert_equal('Xsign', bufname(''))
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
694 sign jump 5 group=g2 file=Xsign
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
695 call assert_equal(12, line('.'))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
696
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
697 " Test for :sign jump command without the filename or buffer
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
698 sign jump 5
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
699 call assert_equal(10, line('.'))
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
700 sign jump 5 group=g1
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
701 call assert_equal(11, line('.'))
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
702
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
703 " Error cases
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
704 call assert_fails("sign place 3 group= name=sign1 buffer=" . bnum, 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
705
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
706 call delete("Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
707 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
708 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
709 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
710 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
711
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
712 " Place signs used for ":sign unplace" command test
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
713 func Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
714 call sign_unplace('*')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
715
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
716 sign place 3 line=10 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
717 sign place 3 group=g1 line=11 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
718 sign place 3 group=g2 line=12 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
719 sign place 4 line=15 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
720 sign place 4 group=g1 line=16 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
721 sign place 4 group=g2 line=17 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
722 sign place 5 line=20 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
723 sign place 5 group=g1 line=21 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
724 sign place 5 group=g2 line=22 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
725 sign place 6 line=25 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
726 sign place 6 group=g1 line=26 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
727 sign place 6 group=g2 line=27 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
728 endfunc
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
729
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
730 " Place multiple signs in a single line for test
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
731 func Place_signs_at_line_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
732 call sign_unplace('*')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
733 sign place 3 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
734 sign place 3 group=g1 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
735 sign place 3 group=g2 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
736 sign place 4 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
737 sign place 4 group=g1 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
738 sign place 4 group=g2 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
739 endfunc
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
740
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
741 " Tests for the ':sign unplace' command
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
742 func Test_sign_unplace()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
743 enew | only
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
744 " Remove all the signs
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
745 call sign_unplace('*')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
746 call sign_undefine()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
747
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
748 " Create two files and define signs
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
749 call writefile(repeat(["Sun is shining"], 30), "Xsign1")
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
750 call writefile(repeat(["It is beautiful"], 30), "Xsign2")
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
751
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
752 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
753 call sign_define("sign1", attr)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
754
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
755 edit Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
756 let bnum1 = bufnr('%')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
757 split Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
758 let bnum2 = bufnr('%')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
759
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
760 let signs1 = [{'id' : 3, 'name' : 'sign1', 'lnum' : 10, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
761 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
762 \ {'id' : 3, 'name' : 'sign1', 'lnum' : 11, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
763 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
764 \ {'id' : 3, 'name' : 'sign1', 'lnum' : 12, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
765 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
766 \ {'id' : 4, 'name' : 'sign1', 'lnum' : 15, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
767 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
768 \ {'id' : 4, 'name' : 'sign1', 'lnum' : 16, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
769 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
770 \ {'id' : 4, 'name' : 'sign1', 'lnum' : 17, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
771 \ 'priority' : 10},]
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
772 let signs2 = [{'id' : 5, 'name' : 'sign1', 'lnum' : 20, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
773 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
774 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 21, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
775 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
776 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 22, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
777 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
778 \ {'id' : 6, 'name' : 'sign1', 'lnum' : 25, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
779 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
780 \ {'id' : 6, 'name' : 'sign1', 'lnum' : 26, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
781 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
782 \ {'id' : 6, 'name' : 'sign1', 'lnum' : 27, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
783 \ 'priority' : 10},]
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
784
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
785 " Test for :sign unplace {id} file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
786 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
787 sign unplace 3 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
788 sign unplace 6 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
789 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
790 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
791 \ {idx, val -> val.id != 3 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
792 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
793 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
794 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
795 \ {idx, val -> val.id != 6 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
796 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
797
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
798 " Test for :sign unplace {id} group={group} file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
799 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
800 sign unplace 4 group=g1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
801 sign unplace 5 group=g2 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
802 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
803 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
804 \ {idx, val -> val.id != 4 || val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
805 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
806 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
807 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
808 \ {idx, val -> val.id != 5 || val.group != 'g2'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
809 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
810
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
811 " Test for :sign unplace {id} group=* file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
812 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
813 sign unplace 3 group=* file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
814 sign unplace 6 group=* file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
815 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
816 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
817 \ {idx, val -> val.id != 3}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
818 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
819 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
820 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
821 \ {idx, val -> val.id != 6}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
822 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
823
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
824 " Test for :sign unplace * file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
825 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
826 sign unplace * file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
827 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
828 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
829 \ {idx, val -> val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
830 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
831 call assert_equal(signs2, sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
832
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
833 " Test for :sign unplace * group={group} file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
834 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
835 sign unplace * group=g1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
836 sign unplace * group=g2 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
837 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
838 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
839 \ {idx, val -> val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
840 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
841 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
842 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
843 \ {idx, val -> val.group != 'g2'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
844 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
845
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
846 " Test for :sign unplace * group=* file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
847 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
848 sign unplace * group=* file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
849 call assert_equal(signs1, sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
850 call assert_equal([], sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
851
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
852 " Test for :sign unplace {id} buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
853 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
854 exe 'sign unplace 3 buffer=' . bnum1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
855 exe 'sign unplace 6 buffer=' . bnum2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
856 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
857 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
858 \ {idx, val -> val.id != 3 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
859 \ sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
860 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
861 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
862 \ {idx, val -> val.id != 6 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
863 \ sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
864
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
865 " Test for :sign unplace {id} group={group} buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
866 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
867 exe 'sign unplace 4 group=g1 buffer=' . bnum1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
868 exe 'sign unplace 5 group=g2 buffer=' . bnum2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
869 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
870 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
871 \ {idx, val -> val.id != 4 || val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
872 \ sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
873 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
874 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
875 \ {idx, val -> val.id != 5 || val.group != 'g2'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
876 \ sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
877
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
878 " Test for :sign unplace {id} group=* buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
879 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
880 exe 'sign unplace 3 group=* buffer=' . bnum1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
881 exe 'sign unplace 6 group=* buffer=' . bnum2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
882 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
883 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
884 \ {idx, val -> val.id != 3}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
885 \ sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
886 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
887 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
888 \ {idx, val -> val.id != 6}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
889 \ sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
890
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
891 " Test for :sign unplace * buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
892 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
893 exe 'sign unplace * buffer=' . bnum1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
894 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
895 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
896 \ {idx, val -> val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
897 \ sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
898 call assert_equal(signs2, sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
899
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
900 " Test for :sign unplace * group={group} buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
901 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
902 exe 'sign unplace * group=g1 buffer=' . bnum1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
903 exe 'sign unplace * group=g2 buffer=' . bnum2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
904 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
905 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
906 \ {idx, val -> val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
907 \ sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
908 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
909 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
910 \ {idx, val -> val.group != 'g2'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
911 \ sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
912
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
913 " Test for :sign unplace * group=* buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
914 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
915 exe 'sign unplace * group=* buffer=' . bnum2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
916 call assert_equal(signs1, sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
917 call assert_equal([], sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
918
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
919 " Test for :sign unplace {id}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
920 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
921 sign unplace 4
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
922 sign unplace 6
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
923 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
924 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
925 \ {idx, val -> val.id != 4 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
926 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
927 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
928 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
929 \ {idx, val -> val.id != 6 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
930 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
931
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
932 " Test for :sign unplace {id} group={group}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
933 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
934 sign unplace 4 group=g1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
935 sign unplace 6 group=g2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
936 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
937 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
938 \ {idx, val -> val.id != 4 || val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
939 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
940 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
941 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
942 \ {idx, val -> val.id != 6 || val.group != 'g2'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
943 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
944
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
945 " Test for :sign unplace {id} group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
946 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
947 sign unplace 3 group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
948 sign unplace 5 group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
949 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
950 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
951 \ {idx, val -> val.id != 3}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
952 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
953 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
954 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
955 \ {idx, val -> val.id != 5}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
956 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
957
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
958 " Test for :sign unplace *
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
959 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
960 sign unplace *
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
961 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
962 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
963 \ {idx, val -> val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
964 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
965 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
966 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
967 \ {idx, val -> val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
968 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
969
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
970 " Test for :sign unplace * group={group}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
971 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
972 sign unplace * group=g1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
973 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
974 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
975 \ {idx, val -> val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
976 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
977 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
978 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
979 \ {idx, val -> val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
980 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
981
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
982 " Test for :sign unplace * group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
983 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
984 sign unplace * group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
985 call assert_equal([], sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
986 call assert_equal([], sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
987
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
988 " Negative test cases
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
989 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
990 sign unplace 3 group=xy file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
991 sign unplace * group=xy file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
992 silent! sign unplace * group=* file=FileNotPresent
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
993 call assert_equal(signs1, sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
994 call assert_equal(signs2, sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
995
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
996 " Tests for removing sign at the current cursor position
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
997
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
998 " Test for ':sign unplace'
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
999 let signs1 = [{'id' : 4, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1000 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1001 \ {'id' : 4, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1002 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1003 \ {'id' : 4, 'name' : 'sign1', 'lnum' : 13, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1004 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1005 \ {'id' : 3, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1006 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1007 \ {'id' : 3, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1008 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1009 \ {'id' : 3, 'name' : 'sign1', 'lnum' : 13, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1010 \ 'priority' : 10},]
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1011 exe bufwinnr('Xsign1') . 'wincmd w'
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1012 call cursor(13, 1)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1013
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1014 " Should remove only one sign in the global group
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1015 call Place_signs_at_line_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1016 sign unplace
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1017 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1018 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1019 \ {idx, val -> val.id != 4 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1020 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1021 " Should remove the second sign in the global group
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1022 sign unplace
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1023 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1024 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1025 \ {idx, val -> val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1026 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1027
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1028 " Test for ':sign unplace group={group}'
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1029 call Place_signs_at_line_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1030 " Should remove only one sign in group g1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1031 sign unplace group=g1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1032 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1033 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1034 \ {idx, val -> val.id != 4 || val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1035 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1036 sign unplace group=g2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1037 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1038 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1039 \ {idx, val -> val.id != 4 || val.group == ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1040 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1041
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1042 " Test for ':sign unplace group=*'
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1043 call Place_signs_at_line_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1044 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1045 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1046 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1047 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1048 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1049 \ {idx, val -> val.id != 4}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1050 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1051 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1052 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1053 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1054 call assert_equal([], sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1055
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1056 call sign_unplace('*')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1057 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1058 enew | only
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1059 call delete("Xsign1")
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1060 call delete("Xsign2")
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1061 endfunc
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1062
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1063 " Tests for auto-generating the sign identifier
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1064 func Test_sign_id_autogen()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1065 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1066 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1067 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1068
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1069 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1070 call assert_equal(0, sign_define("sign1", attr))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1071
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1072 call writefile(repeat(["Sun is shining"], 30), "Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1073 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1074
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1075 call assert_equal(1, sign_place(0, '', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1076 \ {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1077 call assert_equal(2, sign_place(2, '', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1078 \ {'lnum' : 12}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1079 call assert_equal(3, sign_place(0, '', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1080 \ {'lnum' : 14}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1081 call sign_unplace('', {'buffer' : 'Xsign', 'id' : 2})
15271
a6319aca721b patch 8.1.0644: finding next sign ID is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15247
diff changeset
1082 call assert_equal(4, sign_place(0, '', 'sign1', 'Xsign',
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1083 \ {'lnum' : 12}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1084
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1085 call assert_equal(1, sign_place(0, 'g1', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1086 \ {'lnum' : 11}))
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1087 " Check for the next generated sign id in this group
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1088 call assert_equal(2, sign_place(0, 'g1', 'sign1', 'Xsign',
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1089 \ {'lnum' : 12}))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1090 call assert_equal(0, sign_unplace('g1', {'id' : 1}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1091 call assert_equal(10,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1092 \ sign_getplaced('Xsign', {'id' : 1})[0].signs[0].lnum)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1093
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1094 call delete("Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1095 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1096 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1097 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1098 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1099
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1100 " Test for sign priority
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1101 func Test_sign_priority()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1102 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1103 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1104 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1105
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1106 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Search'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1107 call sign_define("sign1", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1108 call sign_define("sign2", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1109 call sign_define("sign3", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1110
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1111 " Place three signs with different priority in the same line
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1112 call writefile(repeat(["Sun is shining"], 30), "Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1113 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1114
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1115 call sign_place(1, 'g1', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1116 \ {'lnum' : 11, 'priority' : 50})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1117 call sign_place(2, 'g2', 'sign2', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1118 \ {'lnum' : 11, 'priority' : 100})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1119 call sign_place(3, '', 'sign3', 'Xsign', {'lnum' : 11})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1120 let s = sign_getplaced('Xsign', {'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1121 call assert_equal([
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1122 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 11, 'group' : 'g2',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1123 \ 'priority' : 100},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1124 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 11, 'group' : 'g1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1125 \ 'priority' : 50},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1126 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 11, 'group' : '',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1127 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1128 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1129
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1130 " Error case
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1131 call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1132 \ [])", 'E715:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1133 call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign',
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1134 \ {'priority' : []})", 'E745:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1135 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1136
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1137 " Tests for the :sign place command with priority
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1138 sign place 5 line=10 name=sign1 priority=30 file=Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1139 sign place 5 group=g1 line=10 name=sign1 priority=20 file=Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1140 sign place 5 group=g2 line=10 name=sign1 priority=25 file=Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1141 let a = execute('sign place group=*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1142 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
1143 \ " line=10 id=5 name=sign1 priority=30\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
1144 \ " line=10 id=5 group=g2 name=sign1 priority=25\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
1145 \ " line=10 id=5 group=g1 name=sign1 priority=20\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1146
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1147 " Test for :sign place group={group}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1148 let a = execute('sign place group=g1')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1149 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
1150 \ " line=10 id=5 group=g1 name=sign1 priority=20\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1151
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1152 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1153 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1154 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1155 call delete("Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1156 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1157
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1158 " Tests for memory allocation failures in sign functions
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1159 func Test_sign_memfailures()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1160 call writefile(repeat(["Sun is shining"], 30), "Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1161 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1162
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1163 call test_alloc_fail(GetAllocId('sign_getdefined'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1164 call assert_fails('call sign_getdefined("sign1")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1165 call test_alloc_fail(GetAllocId('sign_getplaced'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1166 call assert_fails('call sign_getplaced("Xsign")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1167 call test_alloc_fail(GetAllocId('sign_define_by_name'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1168 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1169 call assert_fails('call sign_define("sign1", attr)', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1170
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1171 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1172 call sign_define("sign1", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1173 call test_alloc_fail(GetAllocId('sign_getlist'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1174 call assert_fails('call sign_getdefined("sign1")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1175
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1176 call sign_place(3, 'g1', 'sign1', 'Xsign', {'lnum' : 10})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1177 call test_alloc_fail(GetAllocId('sign_getplaced_dict'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1178 call assert_fails('call sign_getplaced("Xsign")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1179 call test_alloc_fail(GetAllocId('sign_getplaced_list'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1180 call assert_fails('call sign_getplaced("Xsign")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1181
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1182 call test_alloc_fail(GetAllocId('insert_sign'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1183 call assert_fails('call sign_place(4, "g1", "sign1", "Xsign", {"lnum" : 11})',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1184 \ 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1185
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1186 call test_alloc_fail(GetAllocId('sign_getinfo'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1187 call assert_fails('call getbufinfo()', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1188 call sign_place(4, 'g1', 'sign1', 'Xsign', {'lnum' : 11})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1189 call test_alloc_fail(GetAllocId('sign_getinfo'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1190 call assert_fails('let binfo=getbufinfo("Xsign")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1191 call assert_equal([{'lnum': 11, 'id': 4, 'name': 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1192 \ 'priority': 10, 'group': 'g1'}], binfo[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1193
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1194 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1195 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1196 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1197 call delete("Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1198 endfunc
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1199
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1200 " Test for auto-adjusting the line number of a placed sign.
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1201 func Test_sign_lnum_adjust()
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1202 enew! | only!
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1203
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1204 sign define sign1 text=#> linehl=Comment
15519
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1205 call setline(1, ['A', 'B', 'C', 'D', 'E'])
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1206 exe 'sign place 5 line=3 name=sign1 buffer=' . bufnr('')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1207 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1208 call assert_equal(3, l[0].signs[0].lnum)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1209
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1210 " Add some lines before the sign and check the sign line number
15519
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1211 call append(2, ['BA', 'BB', 'BC'])
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1212 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1213 call assert_equal(6, l[0].signs[0].lnum)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1214
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1215 " Delete some lines before the sign and check the sign line number
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1216 call deletebufline('%', 1, 2)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1217 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1218 call assert_equal(4, l[0].signs[0].lnum)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1219
15519
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1220 " Insert some lines after the sign and check the sign line number
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1221 call append(5, ['DA', 'DB'])
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1222 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1223 call assert_equal(4, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1224
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1225 " Delete some lines after the sign and check the sign line number
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1226 call deletebufline('', 6, 7)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1227 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1228 call assert_equal(4, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1229
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1230 " Break the undo. Otherwise the undo operation below will undo all the
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1231 " changes made by this function.
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1232 let &undolevels=&undolevels
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1233
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1234 " Delete the line with the sign
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1235 call deletebufline('', 4)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1236 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1237 call assert_equal(4, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1238
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1239 " Undo the delete operation
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1240 undo
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1241 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1242 call assert_equal(5, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1243
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1244 " Break the undo
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1245 let &undolevels=&undolevels
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1246
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1247 " Delete few lines at the end of the buffer including the line with the sign
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1248 " Sign line number should not change (as it is placed outside of the buffer)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1249 call deletebufline('', 3, 6)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1250 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1251 call assert_equal(5, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1252
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1253 " Undo the delete operation. Sign should be restored to the previous line
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1254 undo
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1255 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1256 call assert_equal(5, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1257
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1258 sign unplace * group=*
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1259 sign undefine sign1
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1260 enew!
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1261 endfunc
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1262
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1263 " Test for changing the type of a placed sign
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1264 func Test_sign_change_type()
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1265 enew! | only!
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1266
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1267 sign define sign1 text=#> linehl=Comment
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1268 sign define sign2 text=@@ linehl=Comment
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1269
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1270 call setline(1, ['A', 'B', 'C', 'D'])
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1271 exe 'sign place 4 line=3 name=sign1 buffer=' . bufnr('')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1272 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1273 call assert_equal('sign1', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1274 exe 'sign place 4 name=sign2 buffer=' . bufnr('')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1275 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1276 call assert_equal('sign2', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1277 call sign_place(4, '', 'sign1', '')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1278 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1279 call assert_equal('sign1', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1280
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1281 exe 'sign place 4 group=g1 line=4 name=sign1 buffer=' . bufnr('')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1282 let l = sign_getplaced(bufnr(''), {'group' : 'g1'})
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1283 call assert_equal('sign1', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1284 exe 'sign place 4 group=g1 name=sign2 buffer=' . bufnr('')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1285 let l = sign_getplaced(bufnr(''), {'group' : 'g1'})
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1286 call assert_equal('sign2', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1287 call sign_place(4, 'g1', 'sign1', '')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1288 let l = sign_getplaced(bufnr(''), {'group' : 'g1'})
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1289 call assert_equal('sign1', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1290
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1291 sign unplace * group=*
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1292 sign undefine sign1
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1293 sign undefine sign2
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1294 enew!
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1295 endfunc
15418
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1296
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1297 " Test for the sign_jump() function
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1298 func Test_sign_jump_func()
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1299 enew! | only!
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1300
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1301 sign define sign1 text=#> linehl=Comment
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1302
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1303 edit foo
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1304 set buftype=nofile
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1305 call setline(1, ['A', 'B', 'C', 'D', 'E'])
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1306 call sign_place(5, '', 'sign1', '', {'lnum' : 2})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1307 call sign_place(5, 'g1', 'sign1', '', {'lnum' : 3})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1308 call sign_place(6, '', 'sign1', '', {'lnum' : 4})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1309 call sign_place(6, 'g1', 'sign1', '', {'lnum' : 5})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1310 split bar
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1311 set buftype=nofile
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1312 call setline(1, ['P', 'Q', 'R', 'S', 'T'])
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1313 call sign_place(5, '', 'sign1', '', {'lnum' : 2})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1314 call sign_place(5, 'g1', 'sign1', '', {'lnum' : 3})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1315 call sign_place(6, '', 'sign1', '', {'lnum' : 4})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1316 call sign_place(6, 'g1', 'sign1', '', {'lnum' : 5})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1317
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1318 let r = sign_jump(5, '', 'foo')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1319 call assert_equal(2, r)
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1320 call assert_equal(2, line('.'))
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1321 let r = sign_jump(6, 'g1', 'foo')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1322 call assert_equal(5, r)
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1323 call assert_equal(5, line('.'))
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1324 let r = sign_jump(5, '', 'bar')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1325 call assert_equal(2, r)
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1326 call assert_equal(2, line('.'))
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1327
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1328 " Error cases
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1329 call assert_fails("call sign_jump(99, '', 'bar')", 'E157:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1330 call assert_fails("call sign_jump(0, '', 'foo')", 'E474:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1331 call assert_fails("call sign_jump(5, 'g5', 'foo')", 'E157:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1332 call assert_fails('call sign_jump([], "", "foo")', 'E745:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1333 call assert_fails('call sign_jump(2, [], "foo")', 'E730:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1334 call assert_fails('call sign_jump(2, "", {})', 'E158:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1335 call assert_fails('call sign_jump(2, "", "baz")', 'E158:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1336
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1337 sign unplace * group=*
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1338 sign undefine sign1
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1339 enew! | only!
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1340 endfunc