Mercurial > vim
annotate src/testdir/test_signs.vim @ 15341:03a7a9fdb792 v8.1.0678
patch 8.1.0678: text properties as not adjusted for inserted text
commit https://github.com/vim/vim/commit/44746aa1eb506ebe6e8fc71f6e549a0dcb754526
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 2 00:02:11 2019 +0100
patch 8.1.0678: text properties as not adjusted for inserted text
Problem: Text properties as not adjusted for inserted text.
Solution: Adjust text properties when inserting text.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 02 Jan 2019 00:15:05 +0100 |
parents | c6c306c5027f |
children | 8543eaf63f65 |
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 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
17 sign define Sign2 text=xy texthl=Title linehl=Error icon=../../pixmaps/stock_vim_find_help.png |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
18 catch /E255:/ |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
19 " 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
|
20 " 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
|
21 " 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
|
22 endtry |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 " Test listing signs. |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 let a=execute('sign list') |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
26 call assert_match("^\nsign Sign1 text=x \nsign Sign2 icon=../../pixmaps/stock_vim_find_help.png .*text=xy linehl=Error texthl=Title$", a) |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 let a=execute('sign list Sign1') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 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
|
30 |
15300
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
31 " 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
|
32 " 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
|
33 let bn = bufnr('%') |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
34 let wn = winnr() |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
35 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
|
36 1 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
37 bot split |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
38 exe 'sign jump 41 buffer=' . bufnr('%') |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
39 call assert_equal('c', getline('.')) |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
40 call assert_equal(3, winnr()) |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
41 call assert_equal(bn, bufnr('%')) |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
42 call assert_notequal(wn, winnr()) |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
43 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
44 " 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
|
45 1 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
46 new foo |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
47 call assert_notequal(bn, bufnr('%')) |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
48 exe 'sign jump 41 buffer=' . bn |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
49 call assert_equal(bn, bufnr('%')) |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call assert_equal('c', getline('.')) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
52 " 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
|
53 " with and without 'rightleft'. |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
54 if has('rightleft') |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
55 set rightleft |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
56 redraw |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
57 set norightleft |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
58 endif |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
59 redraw |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
61 " 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
|
62 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
|
63 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
64 " Check placed signs |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 let a=execute('sign place') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
66 call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n 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
|
67 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
68 " 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
|
69 sign unplace 41 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 1 |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
71 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
|
72 call assert_equal('a', getline('.')) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 " Unplace sign on current line. |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
75 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
|
76 4 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 sign unplace |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 let a=execute('sign place') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 call assert_equal("\n--- Signs ---\n", a) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 " 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
|
82 call assert_fails('sign unplace', 'E159:') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 " Unplace all signs. |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
85 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
|
86 sign unplace * |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 let a=execute('sign place') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 call assert_equal("\n--- Signs ---\n", a) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
90 " Check :jump with file=... |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
91 edit foo |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
92 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
|
93 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
94 try |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
95 sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist icon=doesnotexist.xpm |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
96 catch /E255:/ |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
97 " 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
|
98 endtry |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
99 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
100 let fn = expand('%:p') |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
101 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
|
102 edit bar |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
103 call assert_notequal(fn, expand('%:p')) |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
104 exe 'sign jump 43 file=' . fn |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
105 call assert_equal('B', getline('.')) |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
106 |
15322
c6c306c5027f
patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
15304
diff
changeset
|
107 " 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
|
108 enew! | only! |
c6c306c5027f
patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
15304
diff
changeset
|
109 edit foo |
c6c306c5027f
patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
15304
diff
changeset
|
110 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
|
111 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
|
112 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
|
113 hide edit bar |
c6c306c5027f
patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
15304
diff
changeset
|
114 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
|
115 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
|
116 |
15156
b63787182765
patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
117 " 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
|
118 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
|
119 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
|
120 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
|
121 |
b63787182765
patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
122 " 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
|
123 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
|
124 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
|
125 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
|
126 |
b63787182765
patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
127 " 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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 |
b63787182765
patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 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
|
137 |
b63787182765
patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
138 " 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 |
15322
c6c306c5027f
patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
15304
diff
changeset
|
144 " 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
|
145 sign unplace * |
c6c306c5027f
patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
15304
diff
changeset
|
146 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
|
147 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
|
148 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
|
149 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
|
150 let a = execute('sign place') |
c6c306c5027f
patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
15304
diff
changeset
|
151 call assert_equal("\n--- Signs ---\nSigns for foo:\n line=3 id=20 name=4 priority=10\n", a) |
c6c306c5027f
patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
15304
diff
changeset
|
152 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
|
153 sign undefine 004 |
c6c306c5027f
patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents:
15304
diff
changeset
|
154 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
|
155 |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
156 " Error cases |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
157 call assert_fails("sign place abc 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
|
158 \ bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
159 call assert_fails("sign unplace abc name=Sign1 buffer=" . |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
160 \ bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
161 call assert_fails("sign place 1abc 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
|
162 \ bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
163 call assert_fails("sign unplace 2abc name=Sign1 buffer=" . |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
164 \ bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
165 call assert_fails("sign unplace 2 *", 'E474:') |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
166 call assert_fails("sign place 1 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
|
167 \ bufnr('%') . " a", 'E488:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
168 call assert_fails("sign place name=Sign1 buffer=" . bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
169 call assert_fails("sign place line=10 buffer=" . bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
170 call assert_fails("sign unplace 2 line=10 buffer=" . bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
171 call assert_fails("sign unplace 2 name=Sign1 buffer=" . bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
172 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
|
173 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
|
174 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
|
175 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
|
176 call assert_fails("sign place 5 name=Sign1", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
177 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
|
178 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
|
179 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
|
180 call assert_fails("sign place 5 line=3 name=Sign1", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
181 call assert_fails("sign place 5 group=g1 line=3 name=Sign1", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
182 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 " 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
|
184 sign undefine Sign1 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 sign undefine Sign2 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
186 sign undefine Sign3 |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
187 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
|
188 \ bufnr('%'), 'E155:') |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
189 endfunc |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
191 " Undefining placed sign is not recommended. |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
192 " Quoting :help sign |
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 undefine {name} |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
195 " 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
|
196 " 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
|
197 func Test_sign_undefine_still_placed() |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
198 new foobar |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
199 sign define Sign text=x |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
200 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
|
201 sign undefine Sign |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
202 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
203 " 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
|
204 let a=execute('sign place') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
205 call assert_equal("\n--- Signs ---\nSigns for foobar:\n 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
|
206 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
207 sign unplace 41 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
208 let a=execute('sign place') |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
209 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
|
210 endfunc |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 func Test_sign_completion() |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 sign define Sign1 text=x |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 sign define Sign2 text=y |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 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
|
217 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
|
218 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 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
|
220 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
|
221 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 call feedkeys(":sign define Sign linehl=Spell\<C-A>\<C-B>\"\<CR>", 'tx') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 call assert_equal('"sign define Sign linehl=SpellBad SpellCap SpellLocal SpellRare', @:) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 |
10044
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
225 call writefile(['foo'], 'XsignOne') |
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
226 call writefile(['bar'], 'XsignTwo') |
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
227 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
|
228 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
|
229 call delete('XsignOne') |
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
230 call delete('XsignTwo') |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
231 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 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
|
233 call assert_equal('"sign undefine Sign1 Sign2', @:) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 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
|
236 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
|
237 \ @:) |
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 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
|
240 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
|
241 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 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
|
243 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
|
244 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
245 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
|
246 call assert_equal('"sign list Sign1 Sign2', @:) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
247 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 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
|
249 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
|
250 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
251 sign undefine Sign1 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
252 sign undefine Sign2 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 endfunc |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
254 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
255 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
|
256 sign define Sign1 text=x |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
257 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
258 call assert_fails('sign', 'E471:') |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
259 call assert_fails('sign jump', 'E471:') |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
260 call assert_fails('sign xxx', 'E160:') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
261 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
|
262 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
|
263 call assert_fails('sign undefine', 'E156:') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
264 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
|
265 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
|
266 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
|
267 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
|
268 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
|
269 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
|
270 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
|
271 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
|
272 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
|
273 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
|
274 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
|
275 " Non-numeric identifier for :sign place |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
276 call assert_fails("sign place abc line=3 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
|
277 " Non-numeric identifier for :sign unplace |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
278 call assert_fails("sign unplace abc 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
|
279 " Number followed by an alphabet as sign identifier for :sign place |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
280 call assert_fails("sign place 1abc line=3 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
|
281 " Number followed by an alphabet as sign identifier for :sign unplace |
15247
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 2abc 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
|
283 " 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
|
284 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
|
285 " Trailing characters after buffer number for :sign place |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
286 call assert_fails("sign place 1 line=3 name=Sign1 buffer=" . bufnr('%') . 'xxx', 'E488:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
287 " 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
|
288 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
|
289 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
|
290 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
|
291 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
|
292 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
|
293 " 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
|
294 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
|
295 " 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
|
296 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
|
297 " 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
|
298 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
|
299 " 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
|
300 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
|
301 " 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
|
302 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
|
303 " 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
|
304 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
|
305 " 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
|
306 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
|
307 " 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
|
308 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
|
309 " Placing a sign with only sign name |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
310 call assert_fails("sign place 5 name=Sign1", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
311 " 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
|
312 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
|
313 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
|
314 " 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
|
315 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
|
316 " Placing a sign without buffer number or file name |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
317 call assert_fails("sign place 5 line=3 name=Sign1", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
318 call assert_fails("sign place 5 group=g1 line=3 name=Sign1", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
319 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
320 sign undefine Sign1 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
321 endfunc |
9902
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
322 |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
323 func Test_sign_delete_buffer() |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
324 new |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
325 sign define Sign text=x |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
326 let bufnr = bufnr('%') |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
327 new |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
328 exe 'bd ' . bufnr |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
329 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
|
330 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
|
331 sign unplace 61 |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
332 sign undefine Sign |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
333 endfunc |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
334 |
15271
a6319aca721b
patch 8.1.0644: finding next sign ID is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15247
diff
changeset
|
335 " 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
|
336 func Test_sign_funcs() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
337 " Remove all the signs |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
338 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
339 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
340 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
341 " Tests for sign_define() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
342 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
|
343 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
|
344 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
|
345 \ 'linehl' : 'Search', 'text' : '=>'}], sign_getdefined()) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
346 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
347 " 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
|
348 call sign_define("sign2") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
349 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
|
350 \ 'icon' : 'sign2.ico'} |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
351 try |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
352 call sign_define("sign2", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
353 catch /E255:/ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
354 " 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
|
355 " 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
|
356 endtry |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
357 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
|
358 \ '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
|
359 \ sign_getdefined("sign2")) |
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 " 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
|
362 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
|
363 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
|
364 \ sign_getdefined(0002)) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
365 call sign_undefine(0002) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
366 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
367 " 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
|
368 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
|
369 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
|
370 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
|
371 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
|
372 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
373 " Tests for sign_getdefined() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
374 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
|
375 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
|
376 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
377 " Tests for sign_place() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
378 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
|
379 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
380 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
381 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
|
382 \ {'lnum' : 20})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
383 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
|
384 \ [{'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
|
385 \ 'priority' : 10}]}], sign_getplaced('Xsign')) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
386 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
|
387 \ [{'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
|
388 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
389 \ sign_getplaced('Xsign', {'lnum' : 20})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
390 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
|
391 \ [{'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
|
392 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
393 \ sign_getplaced('Xsign', {'id' : 10})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
394 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
395 " 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
|
396 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
|
397 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
|
398 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
|
399 \ 'E474:') |
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(-1, "", "sign1", "Xsign", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
401 \ {"lnum" : 30})', 'E474:') |
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(10, "", "xsign1x", "Xsign", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
403 \ {"lnum" : 30})', 'E155:') |
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(10, "", "", "Xsign", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
405 \ {"lnum" : 30})', 'E155:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
406 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
|
407 \ {"lnum" : 30})', 'E730:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
408 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
|
409 \ {"lnum" : 10})', 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
410 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
|
411 \ 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
412 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
|
413 \ 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
414 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
|
415 \ {"lnum" : -1})', 'E885:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
416 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
|
417 \ {"lnum" : 0})', 'E885:') |
15304
5bfdce4de97f
patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents:
15300
diff
changeset
|
418 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
|
419 \ {"lnum" : []})', 'E745:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
420 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
|
421 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
422 " Tests for sign_getplaced() |
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 \ [{'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
|
425 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
426 \ sign_getplaced(bufnr('Xsign'))) |
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 \ [{'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
|
429 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
430 \ sign_getplaced()) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
431 call assert_fails("call sign_getplaced('dummy.sign')", 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
432 call assert_fails('call sign_getplaced("")', 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
433 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
|
434 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
|
435 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
|
436 \ sign_getplaced('Xsign', {'lnum' : 1000000})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
437 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
|
438 \ 'E745:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
439 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
|
440 \ sign_getplaced('Xsign', {'id' : 44})) |
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_getplaced('Xsign', {'id' : []})", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
442 \ 'E745:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
443 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
444 " Tests for sign_unplace() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
445 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
|
446 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
|
447 \ {'id' : 20, 'buffer' : 'Xsign'})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
448 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
|
449 \ {'id' : 30, 'buffer' : 'Xsign'})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
450 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
|
451 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
|
452 \ {'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
|
453 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
|
454 \ {'id' : 20, 'buffer' : ''})", 'E158:') |
15304
5bfdce4de97f
patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents:
15300
diff
changeset
|
455 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
|
456 \ {'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
|
457 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
|
458 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
459 " Tests for sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
460 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
|
461 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
|
462 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
|
463 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
|
464 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
465 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
466 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
467 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
468 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
469 endfunc |
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 " Tests for sign groups |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
472 func Test_sign_group() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
473 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
474 " Remove all the signs |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
475 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
476 call sign_undefine() |
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 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
|
479 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
480 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
|
481 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
|
482 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
483 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
484 let bnum = bufnr('%') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
485 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
486 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
487 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
|
488 \ {'lnum' : 30})", 'E730:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
489 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
490 " 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
|
491 " others in the named groups |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
492 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
|
493 \ {'lnum' : 10})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
494 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
|
495 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
|
496 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
497 " 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
|
498 let s = sign_getplaced('Xsign') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
499 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
|
500 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
|
501 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
|
502 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
|
503 \ '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
|
504 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
|
505 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
|
506 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
|
507 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
|
508 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
|
509 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
|
510 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
|
511 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
512 \ {'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
|
513 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
514 \ {'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
|
515 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
516 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
517 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
518 " 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
|
519 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
|
520 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
|
521 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
522 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
523 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
|
524 call assert_equal( |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
525 \ [{'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
|
526 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
527 \ s[0].signs) |
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, {'id' : 5, 'group' : '*'}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
529 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
|
530 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
531 \ {'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
|
532 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
533 \ {'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
|
534 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
535 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
536 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
|
537 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
|
538 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
539 " 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
|
540 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
|
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 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
|
543 call assert_equal( |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
544 \ [{'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
|
545 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
546 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
547 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
|
548 call assert_equal( |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
549 \ [{'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
|
550 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
551 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
552 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
|
553 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
|
554 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
555 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
556 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
|
557 \ 'E730:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
558 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
559 " 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
|
560 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
|
561 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
|
562 call assert_equal([ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
563 \ {'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
|
564 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
565 \ {'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
|
566 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
567 \ s[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 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
|
570 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
|
571 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
|
572 call assert_equal([ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
573 \ {'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
|
574 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
575 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
576 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
577 " 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
|
578 call sign_unplace('*', {'buffer' : bnum}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
579 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
|
580 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
581 " 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
|
582 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
|
583 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
|
584 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
|
585 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
|
586 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
|
587 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
588 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
589 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
|
590 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
591 " 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
|
592 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
|
593 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
|
594 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
595 " 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
|
596 " group |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
597 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
|
598 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
|
599 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
|
600 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
|
601 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
|
602 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
|
603 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
|
604 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
|
605 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
|
606 let s = sign_getplaced(bnum) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
607 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
|
608 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
|
609 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
|
610 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
|
611 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
|
612 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
|
613 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
|
614 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
|
615 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
616 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
617 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
618 " 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
|
619 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
|
620 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
|
621 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
|
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 " 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
|
624 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
625 " :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
|
626 let a = execute('sign place file=Xsign') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
627 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=10 id=5 name=sign1 priority=10\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
628 |
15300
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
629 " :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
|
630 let a = execute('sign place group=g2 file=Xsign') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
631 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=10 id=5 group=g2 name=sign1 priority=10\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
632 |
15300
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
633 " :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
|
634 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
|
635 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
636 \ " line=10 id=5 group=g2 name=sign1 priority=10\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
637 \ " line=10 id=5 group=g1 name=sign1 priority=10\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
638 \ " line=10 id=5 name=sign1 priority=10\n", a) |
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 " 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
|
641 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
|
642 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
|
643 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
644 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
645 let bnum = bufnr('Xsign') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
646 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
|
647 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
|
648 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
|
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 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 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 line=10 id=5 name=sign1 priority=10\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
653 |
15300
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
654 " :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
|
655 let a = execute('sign place group=g2 buffer=' . bnum) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
656 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n line=12 id=5 group=g2 name=sign1 priority=10\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
657 |
15300
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
658 " :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
|
659 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
|
660 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
661 \ " line=10 id=5 name=sign1 priority=10\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
662 \ " line=11 id=5 group=g1 name=sign1 priority=10\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
663 \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
664 |
15300
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
665 " 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
|
666 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
|
667 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
|
668 |
15300
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
669 " :sign place |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
670 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
|
671 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
672 \ " line=10 id=5 name=sign1 priority=10\n", a) |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
673 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
674 " :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
|
675 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
|
676 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
677 \ " line=11 id=5 group=g1 name=sign1 priority=10\n", a) |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
678 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
679 " :sign place group=* |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
680 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
|
681 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
682 \ " line=10 id=5 name=sign1 priority=10\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
683 \ " line=11 id=5 group=g1 name=sign1 priority=10\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
684 \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
685 |
15300
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
686 " 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
|
687 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
|
688 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
|
689 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
|
690 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
|
691 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
|
692 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
693 " Error cases |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
694 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
|
695 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
696 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
697 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
698 call sign_undefine() |
15304
5bfdce4de97f
patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents:
15300
diff
changeset
|
699 enew | only |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
700 endfunc |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
701 |
15300
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
702 " 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
|
703 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
|
704 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
|
705 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
706 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
|
707 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
|
708 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
|
709 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
|
710 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
|
711 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
|
712 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
|
713 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
|
714 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
|
715 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
|
716 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
|
717 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
|
718 endfunc |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
719 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
720 " 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
|
721 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
|
722 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
|
723 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
|
724 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
|
725 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
|
726 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
|
727 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
|
728 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
|
729 endfunc |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
730 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
731 " 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
|
732 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
|
733 enew | only |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
734 " 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
|
735 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
|
736 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
|
737 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
738 " 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
|
739 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
|
740 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
|
741 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
742 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
|
743 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
|
744 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
745 edit Xsign1 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
746 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
|
747 split Xsign2 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
748 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
|
749 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
750 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
|
751 \ 'priority' : 10}, |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
752 \ {'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
|
753 \ 'priority' : 10}, |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
754 \ {'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
|
755 \ 'priority' : 10}, |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
756 \ {'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
|
757 \ 'priority' : 10}, |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
758 \ {'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
|
759 \ 'priority' : 10}, |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
760 \ {'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
|
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 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
|
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' : 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
|
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' : 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
|
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' : 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
|
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' : 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
|
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 \ {'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
|
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 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
775 " 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
|
776 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
|
777 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
|
778 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
|
779 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
|
780 \ 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
|
781 \ {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
|
782 \ 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
|
783 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
|
784 \ 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
|
785 \ {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
|
786 \ 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
|
787 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
788 " 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
|
789 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
|
790 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
|
791 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
|
792 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
|
793 \ 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
|
794 \ {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
|
795 \ 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
|
796 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
|
797 \ 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
|
798 \ {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
|
799 \ 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
|
800 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
801 " 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
|
802 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
|
803 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
|
804 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
|
805 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
|
806 \ 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
|
807 \ {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
|
808 \ 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
|
809 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
|
810 \ 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
|
811 \ {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
|
812 \ 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
|
813 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
814 " 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
|
815 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
|
816 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
|
817 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
|
818 \ 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
|
819 \ {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
|
820 \ 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
|
821 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
|
822 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
823 " 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
|
824 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
|
825 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
|
826 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
|
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 != 'g1'}), |
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( |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
832 \ 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
|
833 \ {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
|
834 \ 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
|
835 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
836 " 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
|
837 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
|
838 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
|
839 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
|
840 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
|
841 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
842 " 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
|
843 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
|
844 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
|
845 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
|
846 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
|
847 \ 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
|
848 \ {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
|
849 \ 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
|
850 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
|
851 \ 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
|
852 \ {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
|
853 \ 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
|
854 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
855 " 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
|
856 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
|
857 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
|
858 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
|
859 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
|
860 \ 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
|
861 \ {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
|
862 \ 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
|
863 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
|
864 \ 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
|
865 \ {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
|
866 \ 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
|
867 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
868 " 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
|
869 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
|
870 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
|
871 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
|
872 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
|
873 \ 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
|
874 \ {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
|
875 \ 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
|
876 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
|
877 \ 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
|
878 \ {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
|
879 \ 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
|
880 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
881 " 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
|
882 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
|
883 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
|
884 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
|
885 \ 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
|
886 \ {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
|
887 \ 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
|
888 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
|
889 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
890 " 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
|
891 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
|
892 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
|
893 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
|
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 != 'g1'}), |
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( |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
899 \ 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
|
900 \ {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
|
901 \ 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
|
902 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
903 " 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
|
904 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
|
905 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
|
906 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
|
907 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
|
908 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
909 " 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
|
910 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
|
911 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
|
912 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
|
913 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
|
914 \ 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
|
915 \ {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
|
916 \ 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
|
917 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
|
918 \ 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
|
919 \ {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
|
920 \ 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
|
921 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
922 " 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
|
923 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
|
924 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
|
925 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
|
926 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
|
927 \ 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
|
928 \ {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
|
929 \ 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
|
930 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
|
931 \ 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
|
932 \ {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
|
933 \ 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
|
934 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
935 " 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
|
936 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
|
937 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
|
938 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
|
939 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
|
940 \ 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
|
941 \ {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
|
942 \ 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
|
943 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
|
944 \ 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
|
945 \ {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
|
946 \ 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
|
947 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
948 " 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
|
949 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
|
950 sign unplace * |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
951 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
|
952 \ 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
|
953 \ {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
|
954 \ 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
|
955 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
|
956 \ 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
|
957 \ {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
|
958 \ 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
|
959 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
960 " 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
|
961 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
|
962 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
|
963 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
|
964 \ 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
|
965 \ {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
|
966 \ 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
|
967 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
|
968 \ 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
|
969 \ {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
|
970 \ 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
|
971 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
972 " 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
|
973 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
|
974 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
|
975 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
|
976 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
|
977 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
978 " 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
|
979 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
|
980 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
|
981 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
|
982 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
|
983 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
|
984 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
|
985 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
986 " 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
|
987 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
988 " 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
|
989 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
|
990 \ 'priority' : 10}, |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
991 \ {'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
|
992 \ 'priority' : 10}, |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
993 \ {'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
|
994 \ 'priority' : 10}, |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
995 \ {'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
|
996 \ 'priority' : 10}, |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
997 \ {'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
|
998 \ 'priority' : 10}, |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
999 \ {'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
|
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 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
|
1002 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
|
1003 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
1004 " 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
|
1005 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
|
1006 sign unplace |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
1007 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
|
1008 \ 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
|
1009 \ {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
|
1010 \ 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
|
1011 " 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
|
1012 sign unplace |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
1013 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
|
1014 \ 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
|
1015 \ {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
|
1016 \ 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
|
1017 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
1018 " 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
|
1019 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
|
1020 " 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
|
1021 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
|
1022 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
|
1023 \ 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
|
1024 \ {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
|
1025 \ 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
|
1026 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
|
1027 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
|
1028 \ 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
|
1029 \ {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
|
1030 \ 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
|
1031 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
1032 " 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
|
1033 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
|
1034 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
|
1035 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
|
1036 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
|
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}), |
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 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
|
1042 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 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
|
1044 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
|
1045 |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
1046 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
|
1047 call sign_undefine() |
15304
5bfdce4de97f
patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents:
15300
diff
changeset
|
1048 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
|
1049 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
|
1050 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
|
1051 endfunc |
890203d87ee5
patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents:
15271
diff
changeset
|
1052 |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1053 " 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
|
1054 func Test_sign_id_autogen() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1055 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1056 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1057 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1058 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1059 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
|
1060 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
|
1061 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1062 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
|
1063 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1064 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1065 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
|
1066 \ {'lnum' : 10})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1067 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
|
1068 \ {'lnum' : 12})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1069 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
|
1070 \ {'lnum' : 14})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1071 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
|
1072 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
|
1073 \ {'lnum' : 12})) |
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, 'g1', 'sign1', 'Xsign', |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1076 \ {'lnum' : 11})) |
15304
5bfdce4de97f
patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents:
15300
diff
changeset
|
1077 " 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
|
1078 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
|
1079 \ {'lnum' : 12})) |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1080 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
|
1081 call assert_equal(10, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1082 \ 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
|
1083 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1084 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1085 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1086 call sign_undefine() |
15304
5bfdce4de97f
patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents:
15300
diff
changeset
|
1087 enew | only |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1088 endfunc |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1089 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1090 " Test for sign priority |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1091 func Test_sign_priority() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1092 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1093 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1094 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1095 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1096 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
|
1097 call sign_define("sign1", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1098 call sign_define("sign2", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1099 call sign_define("sign3", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1100 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1101 " 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
|
1102 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
|
1103 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1104 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1105 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
|
1106 \ {'lnum' : 11, 'priority' : 50}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1107 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
|
1108 \ {'lnum' : 11, 'priority' : 100}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1109 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
|
1110 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
|
1111 call assert_equal([ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1112 \ {'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
|
1113 \ 'priority' : 100}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1114 \ {'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
|
1115 \ 'priority' : 50}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1116 \ {'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
|
1117 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1118 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1119 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1120 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1121 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
|
1122 \ [])", 'E715:') |
15304
5bfdce4de97f
patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents:
15300
diff
changeset
|
1123 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
|
1124 \ {'priority' : []})", 'E745:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1125 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1126 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1127 " 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
|
1128 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
|
1129 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
|
1130 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
|
1131 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
|
1132 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1133 \ " line=10 id=5 name=sign1 priority=30\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1134 \ " line=10 id=5 group=g2 name=sign1 priority=25\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1135 \ " line=10 id=5 group=g1 name=sign1 priority=20\n", a) |
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 " 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
|
1138 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
|
1139 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1140 \ " line=10 id=5 group=g1 name=sign1 priority=20\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1141 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1142 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1143 call sign_undefine() |
15304
5bfdce4de97f
patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents:
15300
diff
changeset
|
1144 enew | only |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1145 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1146 endfunc |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1147 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1148 " 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
|
1149 func Test_sign_memfailures() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1150 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
|
1151 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1152 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1153 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
|
1154 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
|
1155 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
|
1156 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
|
1157 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
|
1158 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
|
1159 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
|
1160 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1161 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
|
1162 call sign_define("sign1", attr) |
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_getlist'), 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 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1166 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
|
1167 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
|
1168 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
|
1169 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
|
1170 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
|
1171 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1172 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
|
1173 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
|
1174 \ '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 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
|
1177 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
|
1178 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
|
1179 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
|
1180 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
|
1181 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
|
1182 \ '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
|
1183 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1184 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1185 call sign_undefine() |
15304
5bfdce4de97f
patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents:
15300
diff
changeset
|
1186 enew | only |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1187 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
1188 endfunc |