Mercurial > vim
annotate src/testdir/test_signs.vim @ 15209:3a99b2e6d136 v8.1.0614
patch 8.1.0614: placing signs can be complicated
commit https://github.com/vim/vim/commit/162b71479bd4dcdb3a2ef9198a1444f6f99e6843
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 21 15:17:36 2018 +0100
patch 8.1.0614: placing signs can be complicated
Problem: Placing signs can be complicated.
Solution: Add functions for defining and placing signs. Introduce a group
name to avoid different plugins using the same signs. (Yegappan
Lakshmanan, closes #3652)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 21 Dec 2018 15:30:07 +0100 |
parents | b63787182765 |
children | 336728a577f5 |
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 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
31 " Split the window to the bottom to verify sign jump will stay in the current window |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
32 " if the buffer is displayed there. |
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. |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
62 call assert_fails("exe 'sign place 40 name=Sign1 buffer=' . bufnr('%')", 'E885:') |
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 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
71 call assert_fails("exe '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 |
15156
b63787182765
patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
107 " 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
|
108 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
|
109 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
|
110 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
|
111 |
b63787182765
patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
112 " 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
|
113 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
|
114 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
|
115 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
|
116 |
b63787182765
patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
117 " 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 |
b63787182765
patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
123 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
|
124 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
|
125 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
|
126 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
|
127 |
b63787182765
patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents:
12692
diff
changeset
|
128 " 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
|
129 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
|
130 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
|
131 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
|
132 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
|
133 |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
134 " Error cases |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
135 call assert_fails("exe 'sign place abc line=3 name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
136 call assert_fails("exe 'sign unplace abc name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
137 call assert_fails("exe 'sign place 1abc line=3 name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
138 call assert_fails("exe 'sign unplace 2abc name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
139 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
|
140 call assert_fails("exe 'sign place 1 line=3 name=Sign1 buffer=' . bufnr('%') a", 'E488:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
141 call assert_fails("exe 'sign place name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
142 call assert_fails("exe 'sign place line=10 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
143 call assert_fails("exe 'sign unplace 2 line=10 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
144 call assert_fails("exe 'sign unplace 2 name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
145 call assert_fails("exe 'sign place 2 line=3 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
146 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
|
147 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
|
148 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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 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
|
154 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
|
155 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 " 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
|
157 sign undefine Sign1 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 sign undefine Sign2 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
159 sign undefine Sign3 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
160 call assert_fails("exe 'sign place 41 line=3 name=Sign1 buffer=' . bufnr('%')", 'E155:') |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
161 endfunc |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
163 " Undefining placed sign is not recommended. |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
164 " Quoting :help sign |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
165 " |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
166 " :sign undefine {name} |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
167 " 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
|
168 " 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
|
169 func Test_sign_undefine_still_placed() |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
170 new foobar |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
171 sign define Sign text=x |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
172 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
|
173 sign undefine Sign |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
174 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
175 " 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
|
176 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
|
177 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
|
178 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
179 sign unplace 41 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
180 let a=execute('sign place') |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
181 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
|
182 endfunc |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 func Test_sign_completion() |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 sign define Sign1 text=x |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 sign define Sign2 text=y |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 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
|
189 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
|
190 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 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
|
192 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
|
193 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 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
|
195 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
|
196 |
10044
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
197 call writefile(['foo'], 'XsignOne') |
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
198 call writefile(['bar'], 'XsignTwo') |
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
199 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
|
200 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
|
201 call delete('XsignOne') |
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
202 call delete('XsignTwo') |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
203 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 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
|
205 call assert_equal('"sign undefine Sign1 Sign2', @:) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 call feedkeys(":sign place 1 \<C-A>\<C-B>\"\<CR>", 'tx') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 call assert_equal('"sign place 1 buffer= file= line= name=', @:) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 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
|
211 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
|
212 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 call feedkeys(":sign unplace 1 \<C-A>\<C-B>\"\<CR>", 'tx') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 call assert_equal('"sign unplace 1 buffer= file=', @:) |
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 list \<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 list Sign1 Sign2', @:) |
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 jump 1 \<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 jump 1 buffer= file=', @:) |
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 sign undefine Sign1 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 sign undefine Sign2 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 endfunc |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 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
|
227 sign define Sign1 text=x |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
228 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 call assert_fails('sign', 'E471:') |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
230 call assert_fails('sign jump', 'E471:') |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 call assert_fails('sign xxx', 'E160:') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 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
|
233 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
|
234 call assert_fails('sign undefine', 'E156:') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 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
|
236 call assert_fails('sign place 1 buffer=999', 'E158:') |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 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
|
238 " Non-numeric identifier for :sign place |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
239 call assert_fails("exe 'sign place abc line=3 name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
240 " Non-numeric identifier for :sign unplace |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
241 call assert_fails("exe 'sign unplace abc name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
242 " Number followed by an alphabet as sign identifier for :sign place |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
243 call assert_fails("exe 'sign place 1abc line=3 name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
244 " Number followed by an alphabet as sign identifier for :sign unplace |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
245 call assert_fails("exe 'sign unplace 2abc name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
246 " 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
|
247 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
|
248 " Trailing characters after buffer number for :sign place |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
249 call assert_fails("exe 'sign place 1 line=3 name=Sign1 buffer=' . bufnr('%') . 'xxx'", 'E488:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
250 " Trailing characters after buffer number for :sign unplace |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
251 call assert_fails("exe 'sign unplace 1 buffer=' . bufnr('%') . 'xxx'", 'E488:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
252 call assert_fails("exe 'sign unplace * buffer=' . bufnr('%') . 'xxx'", 'E488:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
253 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
|
254 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
|
255 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
|
256 " Placing a sign without line number |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
257 call assert_fails("exe 'sign place name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
258 " Placing a sign without sign name |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
259 call assert_fails("exe 'sign place line=10 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
260 " Unplacing a sign with line number |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
261 call assert_fails("exe 'sign unplace 2 line=10 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
262 " Unplacing a sign with sign name |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
263 call assert_fails("exe 'sign unplace 2 name=Sign1 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
264 " Placing a sign without sign name |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
265 call assert_fails("exe 'sign place 2 line=3 buffer=' . bufnr('%')", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
266 " 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
|
267 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
|
268 " 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
|
269 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
|
270 " 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
|
271 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
|
272 " 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
|
273 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
|
274 " 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
|
275 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
|
276 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
|
277 " 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
|
278 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
|
279 " 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
|
280 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
|
281 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
|
282 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
283 sign undefine Sign1 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
284 endfunc |
9902
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
285 |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
286 func Test_sign_delete_buffer() |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
287 new |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
288 sign define Sign text=x |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
289 let bufnr = bufnr('%') |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
290 new |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
291 exe 'bd ' . bufnr |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
292 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
|
293 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
|
294 sign unplace 61 |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
295 sign undefine Sign |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
296 endfunc |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
297 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
298 " Test for VimL functions for managing signs |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
299 func Test_sign_funcs() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
300 " Remove all the signs |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
301 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
302 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
303 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
304 " Tests for sign_define() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
305 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
|
306 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
|
307 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
|
308 \ 'linehl' : 'Search', 'text' : '=>'}], sign_getdefined()) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
309 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
310 " 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
|
311 call sign_define("sign2") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
312 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
|
313 \ 'icon' : 'sign2.ico'} |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
314 try |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
315 call sign_define("sign2", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
316 catch /E255:/ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
317 " 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
|
318 " 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
|
319 endtry |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
320 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
|
321 \ '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
|
322 \ sign_getdefined("sign2")) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
323 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
324 " 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
|
325 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
|
326 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
|
327 \ sign_getdefined(0002)) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
328 call sign_undefine(0002) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
329 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
330 " 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
|
331 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
|
332 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
|
333 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
|
334 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
|
335 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
336 " Tests for sign_getdefined() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
337 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
|
338 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
|
339 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
340 " Tests for sign_place() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
341 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
|
342 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
343 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
344 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
|
345 \ {'lnum' : 20})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
346 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
|
347 \ [{'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
|
348 \ 'priority' : 10}]}], sign_getplaced('Xsign')) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
349 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
|
350 \ [{'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
|
351 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
352 \ sign_getplaced('Xsign', {'lnum' : 20})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
353 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
|
354 \ [{'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
|
355 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
356 \ sign_getplaced('Xsign', {'id' : 10})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
357 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
358 " 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
|
359 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
|
360 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
|
361 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
|
362 \ 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
363 call assert_fails('call sign_place(-1, "", "sign1", "Xsign", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
364 \ {"lnum" : 30})', 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
365 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
|
366 \ {"lnum" : 30})', 'E155:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
367 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
|
368 \ {"lnum" : 30})', 'E155:') |
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_place(10, "", [], "Xsign", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
370 \ {"lnum" : 30})', '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_place(5, "", "sign1", "abcxyz.xxx", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
372 \ {"lnum" : 10})', 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
373 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
|
374 \ 'E158:') |
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_place(5, "", "sign1", [], {"lnum" : 10})', |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
376 \ 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
377 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
|
378 \ {"lnum" : -1})', 'E885:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
379 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
|
380 \ {"lnum" : 0})', 'E885:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
381 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
|
382 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
383 " Tests for sign_getplaced() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
384 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
|
385 \ [{'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
|
386 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
387 \ sign_getplaced(bufnr('Xsign'))) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
388 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
|
389 \ [{'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
|
390 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
391 \ sign_getplaced()) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
392 call assert_fails("call sign_getplaced('dummy.sign')", 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
393 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
|
394 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
|
395 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
|
396 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
|
397 \ sign_getplaced('Xsign', {'lnum' : 1000000})) |
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_getplaced('Xsign', {'lnum' : []})", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
399 \ 'E745:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
400 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
|
401 \ sign_getplaced('Xsign', {'id' : 44})) |
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_getplaced('Xsign', {'id' : []})", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
403 \ 'E745:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
404 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
405 " Tests for sign_unplace() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
406 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
|
407 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
|
408 \ {'id' : 20, 'buffer' : 'Xsign'})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
409 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
|
410 \ {'id' : 30, 'buffer' : 'Xsign'})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
411 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
|
412 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
|
413 \ {'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
|
414 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
|
415 \ {'id' : 20, 'buffer' : ''})", 'E158:') |
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_unplace('', |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
417 \ {'id' : 20, 'buffer' : 200})", 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
418 call assert_fails("call sign_unplace('', 'mySign')", 'E715:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
419 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
420 " Tests for sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
421 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
|
422 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
|
423 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
|
424 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
|
425 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
426 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
427 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
428 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
429 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
430 endfunc |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
431 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
432 " Tests for sign groups |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
433 func Test_sign_group() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
434 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
435 " Remove all the signs |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
436 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
437 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
438 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
439 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
|
440 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
441 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
|
442 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
|
443 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
444 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
445 let bnum = bufnr('%') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
446 let fname = fnamemodify('Xsign', ':p') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
447 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
448 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
449 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
|
450 \ {'lnum' : 30})", 'E730:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
451 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
452 " 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
|
453 " others in the named groups |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
454 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
|
455 \ {'lnum' : 10})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
456 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
|
457 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
|
458 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
459 " 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
|
460 let s = sign_getplaced('Xsign') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
461 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
|
462 call assert_equal(s[0].signs[0].group, '') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
463 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
|
464 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
|
465 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
|
466 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
|
467 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
|
468 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
|
469 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
470 \ {'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
|
471 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
472 \ {'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
|
473 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
474 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
475 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
476 " 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
|
477 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
|
478 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
|
479 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
480 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
481 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
|
482 call assert_equal( |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
483 \ [{'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
|
484 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
485 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
486 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
|
487 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
|
488 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
489 \ {'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
|
490 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
491 \ {'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
|
492 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
493 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
494 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
|
495 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
|
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 lnum |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
498 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
|
499 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
|
500 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
|
501 call assert_equal( |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
502 \ [{'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
|
503 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
504 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
505 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
|
506 call assert_equal( |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
507 \ [{'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
|
508 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
509 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
510 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
|
511 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
|
512 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
513 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
514 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
|
515 \ 'E730:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
516 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
517 " 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
|
518 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
|
519 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
|
520 call assert_equal([ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
521 \ {'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
|
522 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
523 \ {'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
|
524 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
525 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
526 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
527 " 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
|
528 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
|
529 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
|
530 call assert_equal([ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
531 \ {'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
|
532 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
533 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
534 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
535 " 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
|
536 call sign_unplace('*', {'buffer' : bnum}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
537 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
|
538 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
539 " 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
|
540 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
|
541 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
|
542 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
|
543 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
|
544 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
|
545 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
546 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
547 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
|
548 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
549 " 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
|
550 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
|
551 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
|
552 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
553 " 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
|
554 " group |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
555 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
|
556 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
|
557 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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 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
|
563 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
|
564 let s = sign_getplaced(bnum) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
565 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
|
566 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
|
567 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
|
568 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
|
569 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
|
570 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
|
571 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
|
572 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
|
573 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
574 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
575 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
576 " Test for :sign command and groups |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
577 exe 'sign place 5 line=10 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
578 exe 'sign place 5 group=g1 line=10 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
579 exe 'sign place 5 group=g2 line=10 name=sign1 file=' . fname |
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 " Test for :sign place group={group} file={fname} |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
582 let a = execute('sign place file=' . fname) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
583 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
|
584 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
585 let a = execute('sign place group=g2 file=' . fname) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
586 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
|
587 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
588 let a = execute('sign place group=* file=' . fname) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
589 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
|
590 \ " 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
|
591 \ " 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
|
592 \ " 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
|
593 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
594 let a = execute('sign place group=xyz file=' . fname) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
595 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
|
596 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
597 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
598 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
599 " Test for :sign place group={group} buffer={nr} |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
600 let bnum = bufnr('Xsign') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
601 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
|
602 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
|
603 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
|
604 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
605 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
|
606 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
|
607 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
608 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
|
609 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
|
610 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
611 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
|
612 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
|
613 \ " 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
|
614 \ " 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
|
615 \ " 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
|
616 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
617 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
|
618 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
|
619 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
620 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
|
621 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
|
622 \ " 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
|
623 \ " 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
|
624 \ " 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
|
625 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
626 " Test for :sign unplace |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
627 exe 'sign unplace 5 group=g2 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
628 call assert_equal([], sign_getplaced(bnum, {'group' : 'g2'})[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
629 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
630 exe 'sign unplace 5 group=g1 buffer=' . bnum |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
631 call assert_equal([], sign_getplaced(bnum, {'group' : 'g1'})[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
632 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
633 exe 'sign unplace 5 group=xy file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
634 call assert_equal(1, len(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
|
635 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
636 " Test for removing all the signs. Place the signs again for this test |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
637 exe 'sign place 5 group=g1 line=11 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
638 exe 'sign place 5 group=g2 line=12 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
639 exe 'sign place 6 line=20 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
640 exe 'sign place 6 group=g1 line=21 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
641 exe 'sign place 6 group=g2 line=22 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
642 exe 'sign unplace 5 group=* file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
643 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
|
644 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
|
645 \ " line=20 id=6 name=sign1 priority=10\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
646 \ " line=21 id=6 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
|
647 \ " line=22 id=6 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
|
648 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
649 " Remove all the signs from the global group |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
650 exe 'sign unplace * file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
651 let a = execute('sign place group=*') |
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" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
653 \ " line=21 id=6 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
|
654 \ " line=22 id=6 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
|
655 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
656 " Remove all the signs from a particular group |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
657 exe 'sign place 5 line=10 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
658 exe 'sign place 5 group=g1 line=11 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
659 exe 'sign place 5 group=g2 line=12 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
660 exe 'sign unplace * group=g1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
661 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
|
662 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
|
663 \ " 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
|
664 \ " line=12 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
|
665 \ " line=22 id=6 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
|
666 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
667 " Remove all the signs from all the groups in a file |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
668 exe 'sign place 5 group=g1 line=11 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
669 exe 'sign place 6 line=20 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
670 exe 'sign place 6 group=g1 line=21 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
671 exe 'sign unplace * group=* file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
672 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
|
673 call assert_equal("\n--- Signs ---\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
674 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
675 " Remove a particular sign id in a group from all the files |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
676 exe 'sign place 5 group=g1 line=11 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
677 sign unplace 5 group=g1 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
678 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
|
679 call assert_equal("\n--- Signs ---\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
680 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
681 " Remove a particular sign id in all the groups from all the files |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
682 exe 'sign place 5 line=10 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
683 exe 'sign place 5 group=g1 line=11 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
684 exe 'sign place 5 group=g2 line=12 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
685 exe 'sign place 6 line=20 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
686 exe 'sign place 6 group=g1 line=21 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
687 exe 'sign place 6 group=g2 line=22 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
688 sign unplace 5 group=* |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
689 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
|
690 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
|
691 \ " line=20 id=6 name=sign1 priority=10\n" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
692 \ " line=21 id=6 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
|
693 \ " line=22 id=6 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
|
694 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
695 " Remove all the signs from all the groups in all the files |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
696 exe 'sign place 5 line=10 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
697 exe 'sign place 5 group=g1 line=11 name=sign1 file=' . fname |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
698 sign unplace * group=* |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
699 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
|
700 call assert_equal("\n--- Signs ---\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
701 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
702 " Error cases |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
703 call assert_fails("exe 'sign place 3 group= name=sign1 buffer=' . bnum", 'E474:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
704 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
705 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
706 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
707 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
708 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
709 endfunc |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
710 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
711 " 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
|
712 func Test_sign_id_autogen() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
713 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
714 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
715 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
716 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
717 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
|
718 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
|
719 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
720 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
|
721 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
722 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
723 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
|
724 \ {'lnum' : 10})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
725 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
|
726 \ {'lnum' : 12})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
727 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
|
728 \ {'lnum' : 14})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
729 call sign_unplace('', {'buffer' : 'Xsign', 'id' : 2}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
730 call assert_equal(2, sign_place(0, '', 'sign1', 'Xsign', |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
731 \ {'lnum' : 12})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
732 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
733 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
|
734 \ {'lnum' : 11})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
735 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
|
736 call assert_equal(10, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
737 \ 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
|
738 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
739 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
740 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
741 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
742 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
743 endfunc |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
744 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
745 " Test for sign priority |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
746 func Test_sign_priority() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
747 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
748 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
749 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
750 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
751 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
|
752 call sign_define("sign1", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
753 call sign_define("sign2", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
754 call sign_define("sign3", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
755 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
756 " 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
|
757 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
|
758 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
759 let fname = fnamemodify('Xsign', ':p') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
760 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
761 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
|
762 \ {'lnum' : 11, 'priority' : 50}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
763 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
|
764 \ {'lnum' : 11, 'priority' : 100}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
765 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
|
766 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
|
767 call assert_equal([ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
768 \ {'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
|
769 \ 'priority' : 100}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
770 \ {'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
|
771 \ 'priority' : 50}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
772 \ {'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
|
773 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
774 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
775 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
776 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
777 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
|
778 \ [])", 'E715:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
779 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
780 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
781 " 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
|
782 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
|
783 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
|
784 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
|
785 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
|
786 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
|
787 \ " 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
|
788 \ " 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
|
789 \ " 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
|
790 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
791 " 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
|
792 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
|
793 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
|
794 \ " 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
|
795 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
796 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
797 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
798 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
799 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
800 endfunc |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
801 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
802 " 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
|
803 func Test_sign_memfailures() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
804 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
|
805 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
806 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
807 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
|
808 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
|
809 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
|
810 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
|
811 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
|
812 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
|
813 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
|
814 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
815 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
|
816 call sign_define("sign1", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
817 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
|
818 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
|
819 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
820 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
|
821 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
|
822 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
|
823 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
|
824 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
|
825 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
826 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
|
827 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
|
828 \ 'E342:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
829 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
830 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
|
831 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
|
832 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
|
833 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
|
834 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
|
835 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
|
836 \ '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
|
837 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
838 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
839 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
840 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
841 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
842 endfunc |