Mercurial > vim
annotate src/testdir/test_signs.vim @ 15247:336728a577f5 v8.1.0632
patch 8.1.0632: using sign group names is inefficient
commit https://github.com/vim/vim/commit/7a2d9892b7158edf8dc48e9bcaaae70a40787b37
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 24 20:23:49 2018 +0100
patch 8.1.0632: using sign group names is inefficient
Problem: Using sign group names is inefficient.
Solution: Store group names in a hash table and use a reference to them.
Also remove unnecessary use of ":exe" from the tests. (Yegappan
Lakshmanan, closes #3715)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 24 Dec 2018 20:30:04 +0100 |
parents | 3a99b2e6d136 |
children | a6319aca721b |
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. |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
62 call assert_fails("sign place 40 name=Sign1 buffer=" . bufnr('%'), 'E885:') |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
63 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
64 " Check placed signs |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 let a=execute('sign place') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
66 call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n line=3 id=41 name=Sign1 priority=10\n", a) |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
68 " Unplace the sign and try jumping to it again should fail. |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
69 sign unplace 41 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 1 |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
71 call assert_fails("sign jump 41 buffer=" . bufnr('%'), 'E157:') |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 call assert_equal('a', getline('.')) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 " Unplace sign on current line. |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
75 exe 'sign place 42 line=4 name=Sign2 buffer=' . bufnr('%') |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 4 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 sign unplace |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 let a=execute('sign place') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 call assert_equal("\n--- Signs ---\n", a) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 " Try again to unplace sign on current line, it should fail this time. |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 call assert_fails('sign unplace', 'E159:') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 " Unplace all signs. |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
85 exe 'sign place 41 line=3 name=Sign1 buffer=' . bufnr('%') |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 sign unplace * |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 let a=execute('sign place') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 call assert_equal("\n--- Signs ---\n", a) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
90 " Check :jump with file=... |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
91 edit foo |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
92 call setline(1, ['A', 'B', 'C', 'D']) |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
93 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
94 try |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
95 sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist icon=doesnotexist.xpm |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
96 catch /E255:/ |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
97 " ignore error: E255: it can happens for guis. |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
98 endtry |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
99 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
100 let fn = expand('%:p') |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
101 exe 'sign place 43 line=2 name=Sign3 file=' . fn |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
102 edit bar |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
103 call assert_notequal(fn, expand('%:p')) |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
104 exe 'sign jump 43 file=' . fn |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
105 call assert_equal('B', getline('.')) |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
106 |
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 |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
135 call assert_fails("sign place abc line=3 name=Sign1 buffer=" . |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
136 \ bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
137 call assert_fails("sign unplace abc name=Sign1 buffer=" . |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
138 \ bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
139 call assert_fails("sign place 1abc line=3 name=Sign1 buffer=" . |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
140 \ bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
141 call assert_fails("sign unplace 2abc name=Sign1 buffer=" . |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
142 \ bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
143 call assert_fails("sign unplace 2 *", 'E474:') |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
144 call assert_fails("sign place 1 line=3 name=Sign1 buffer=" . |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
145 \ bufnr('%') . " a", 'E488:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
146 call assert_fails("sign place name=Sign1 buffer=" . bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
147 call assert_fails("sign place line=10 buffer=" . bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
148 call assert_fails("sign unplace 2 line=10 buffer=" . bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
149 call assert_fails("sign unplace 2 name=Sign1 buffer=" . bufnr('%'), 'E474:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
150 call assert_fails("sign place 2 line=3 buffer=" . bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
151 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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 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
|
160 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 " 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
|
162 sign undefine Sign1 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 sign undefine Sign2 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
164 sign undefine Sign3 |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
165 call assert_fails("sign place 41 line=3 name=Sign1 buffer=" . |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
166 \ bufnr('%'), 'E155:') |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
167 endfunc |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
169 " Undefining placed sign is not recommended. |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
170 " Quoting :help sign |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
171 " |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
172 " :sign undefine {name} |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
173 " 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
|
174 " 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
|
175 func Test_sign_undefine_still_placed() |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
176 new foobar |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
177 sign define Sign text=x |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
178 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
|
179 sign undefine Sign |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
180 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
181 " 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
|
182 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
|
183 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
|
184 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
185 sign unplace 41 |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
186 let a=execute('sign place') |
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
187 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
|
188 endfunc |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 func Test_sign_completion() |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 sign define Sign1 text=x |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 sign define Sign2 text=y |
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 \<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 jump list place undefine unplace', @:) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 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
|
198 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
|
199 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 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
|
201 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
|
202 |
10044
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
203 call writefile(['foo'], 'XsignOne') |
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
204 call writefile(['bar'], 'XsignTwo') |
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
205 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
|
206 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
|
207 call delete('XsignOne') |
46e630ac4380
commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents:
9902
diff
changeset
|
208 call delete('XsignTwo') |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
209 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 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
|
211 call assert_equal('"sign undefine 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 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
|
214 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
|
215 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 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
|
217 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
|
218 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 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
|
220 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
|
221 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 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
|
223 call assert_equal('"sign list Sign1 Sign2', @:) |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 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
|
226 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
|
227 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 sign undefine Sign1 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 sign undefine Sign2 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 endfunc |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 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
|
233 sign define Sign1 text=x |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
234 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 call assert_fails('sign', 'E471:') |
9838
66f1cf5dd385
commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents:
9816
diff
changeset
|
236 call assert_fails('sign jump', 'E471:') |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 call assert_fails('sign xxx', 'E160:') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 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
|
239 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
|
240 call assert_fails('sign undefine', 'E156:') |
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 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
|
242 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
|
243 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
|
244 " Non-numeric identifier for :sign place |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
245 call assert_fails("sign place abc line=3 name=Sign1 buffer=" . bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
246 " Non-numeric identifier for :sign unplace |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
247 call assert_fails("sign unplace abc name=Sign1 buffer=" . bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
248 " Number followed by an alphabet as sign identifier for :sign place |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
249 call assert_fails("sign place 1abc line=3 name=Sign1 buffer=" . bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
250 " Number followed by an alphabet as sign identifier for :sign unplace |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
251 call assert_fails("sign unplace 2abc name=Sign1 buffer=" . bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
252 " 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
|
253 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
|
254 " Trailing characters after buffer number for :sign place |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
255 call assert_fails("sign place 1 line=3 name=Sign1 buffer=" . bufnr('%') . 'xxx', 'E488:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
256 " Trailing characters after buffer number for :sign unplace |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
257 call assert_fails("sign unplace 1 buffer=" . bufnr('%') . 'xxx', 'E488:') |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
258 call assert_fails("sign unplace * buffer=" . bufnr('%') . 'xxx', 'E488:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
259 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
|
260 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
|
261 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
|
262 " Placing a sign without line number |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
263 call assert_fails("sign place name=Sign1 buffer=" . bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
264 " Placing a sign without sign name |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
265 call assert_fails("sign place line=10 buffer=" . bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
266 " Unplacing a sign with line number |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
267 call assert_fails("sign unplace 2 line=10 buffer=" . bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
268 " Unplacing a sign with sign name |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
269 call assert_fails("sign unplace 2 name=Sign1 buffer=" . bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
270 " Placing a sign without sign name |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
271 call assert_fails("sign place 2 line=3 buffer=" . bufnr('%'), 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
272 " 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
|
273 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
|
274 " 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
|
275 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
|
276 " 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
|
277 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
|
278 " 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
|
279 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
|
280 " 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
|
281 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
|
282 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
|
283 " 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
|
284 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
|
285 " 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
|
286 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
|
287 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
|
288 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
289 sign undefine Sign1 |
9816
74990ddf0813
commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
290 endfunc |
9902
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
291 |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
292 func Test_sign_delete_buffer() |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
293 new |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
294 sign define Sign text=x |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
295 let bufnr = bufnr('%') |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
296 new |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
297 exe 'bd ' . bufnr |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
298 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
|
299 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
|
300 sign unplace 61 |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
301 sign undefine Sign |
5a667a3a3743
commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents:
9838
diff
changeset
|
302 endfunc |
15209
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 " 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
|
305 func Test_sign_funcs() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
306 " Remove all the signs |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
307 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
308 call sign_undefine() |
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 " Tests for sign_define() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
311 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
|
312 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
|
313 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
|
314 \ 'linehl' : 'Search', 'text' : '=>'}], sign_getdefined()) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
315 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
316 " 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
|
317 call sign_define("sign2") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
318 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
|
319 \ 'icon' : 'sign2.ico'} |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
320 try |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
321 call sign_define("sign2", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
322 catch /E255:/ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
323 " 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
|
324 " 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
|
325 endtry |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
326 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
|
327 \ '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
|
328 \ sign_getdefined("sign2")) |
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 " 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
|
331 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
|
332 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
|
333 \ sign_getdefined(0002)) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
334 call sign_undefine(0002) |
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 invalid arguments to sign_define() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
337 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
|
338 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
|
339 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
|
340 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
|
341 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
342 " Tests for sign_getdefined() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
343 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
|
344 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
|
345 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
346 " Tests for sign_place() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
347 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
|
348 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
349 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
350 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
|
351 \ {'lnum' : 20})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
352 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
|
353 \ [{'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
|
354 \ 'priority' : 10}]}], sign_getplaced('Xsign')) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
355 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
|
356 \ [{'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
|
357 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
358 \ sign_getplaced('Xsign', {'lnum' : 20})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
359 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
|
360 \ [{'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
|
361 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
362 \ sign_getplaced('Xsign', {'id' : 10})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
363 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
364 " 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
|
365 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
|
366 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
|
367 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
|
368 \ 'E474:') |
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(-1, "", "sign1", "Xsign", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
370 \ {"lnum" : 30})', 'E474:') |
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(10, "", "xsign1x", "Xsign", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
372 \ {"lnum" : 30})', 'E155:') |
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(10, "", "", "Xsign", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
374 \ {"lnum" : 30})', 'E155:') |
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(10, "", [], "Xsign", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
376 \ {"lnum" : 30})', 'E730:') |
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(5, "", "sign1", "abcxyz.xxx", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
378 \ {"lnum" : 10})', 'E158:') |
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(5, "", "sign1", "", {"lnum" : 10})', |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
380 \ 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
381 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
|
382 \ 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
383 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
|
384 \ {"lnum" : -1})', 'E885:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
385 call assert_fails('call sign_place(22, "", "sign1", "Xsign", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
386 \ {"lnum" : 0})', 'E885:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
387 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
|
388 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
389 " Tests for sign_getplaced() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
390 call assert_equal([{'bufnr' : bufnr(''), 'signs' : |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
391 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1', |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
392 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
393 \ sign_getplaced(bufnr('Xsign'))) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
394 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
|
395 \ [{'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
|
396 \ 'priority' : 10}]}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
397 \ sign_getplaced()) |
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('dummy.sign')", 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
399 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
|
400 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
|
401 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
|
402 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
|
403 \ sign_getplaced('Xsign', {'lnum' : 1000000})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
404 call assert_fails("call sign_getplaced('Xsign', {'lnum' : []})", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
405 \ 'E745:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
406 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
|
407 \ sign_getplaced('Xsign', {'id' : 44})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
408 call assert_fails("call sign_getplaced('Xsign', {'id' : []})", |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
409 \ 'E745:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
410 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
411 " Tests for sign_unplace() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
412 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
|
413 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
|
414 \ {'id' : 20, 'buffer' : 'Xsign'})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
415 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
|
416 \ {'id' : 30, 'buffer' : 'Xsign'})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
417 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
|
418 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
|
419 \ {'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
|
420 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
|
421 \ {'id' : 20, 'buffer' : ''})", 'E158:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
422 call assert_fails("call sign_unplace('', |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
423 \ {'id' : 20, 'buffer' : 200})", 'E158:') |
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_unplace('', 'mySign')", 'E715:') |
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 " Tests for sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
427 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
|
428 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
|
429 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
|
430 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
|
431 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
432 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
433 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
434 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
435 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
436 endfunc |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
437 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
438 " Tests for sign groups |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
439 func Test_sign_group() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
440 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
441 " Remove all the signs |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
442 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
443 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
444 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
445 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
|
446 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
447 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
|
448 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
|
449 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
450 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
451 let bnum = bufnr('%') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
452 let fname = fnamemodify('Xsign', ':p') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
453 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
454 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
455 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
|
456 \ {'lnum' : 30})", 'E730:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
457 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
458 " 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
|
459 " others in the named groups |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
460 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
|
461 \ {'lnum' : 10})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
462 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
|
463 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
|
464 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
465 " 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
|
466 let s = sign_getplaced('Xsign') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
467 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
|
468 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
|
469 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
|
470 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
|
471 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
|
472 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
|
473 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
|
474 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
|
475 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
476 \ {'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
|
477 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
478 \ {'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
|
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 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
482 " 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
|
483 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
|
484 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
|
485 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
486 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
487 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
|
488 call assert_equal( |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
489 \ [{'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
|
490 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
491 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
492 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
|
493 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
|
494 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
495 \ {'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
|
496 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
497 \ {'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
|
498 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
499 \ 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, {'id' : 5, 'group' : 'g3'}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
501 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
|
502 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
503 " 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
|
504 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
|
505 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
|
506 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
|
507 call assert_equal( |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
508 \ [{'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
|
509 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
510 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
511 let s = sign_getplaced(bnum, {'lnum' : 30, 'group' : '*'}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
512 call assert_equal( |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
513 \ [{'id' : 5, 'name' : 'sign1', 'lnum' : 30, 'group' : 'g2', |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
514 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
515 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
516 let s = sign_getplaced(bnum, {'lnum' : 40, 'group' : '*'}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
517 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
|
518 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
519 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
520 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
|
521 \ 'E730:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
522 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
523 " 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
|
524 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
|
525 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
|
526 call assert_equal([ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
527 \ {'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
|
528 \ 'priority' : 10}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
529 \ {'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
|
530 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
531 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
532 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
533 " 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
|
534 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
|
535 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
|
536 call assert_equal([ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
537 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 30, 'group' : 'g2', |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
538 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
539 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
540 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
541 " 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
|
542 call sign_unplace('*', {'buffer' : bnum}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
543 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
|
544 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
545 " 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
|
546 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
|
547 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
|
548 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
|
549 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
|
550 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
|
551 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
552 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
553 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
|
554 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
555 " 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
|
556 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
|
557 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
|
558 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
559 " 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
|
560 " group |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
561 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 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
|
568 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
|
569 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
|
570 let s = sign_getplaced(bnum) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
571 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
|
572 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
|
573 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
|
574 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
|
575 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
|
576 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
|
577 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
|
578 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
|
579 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
580 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
581 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
582 " Test for :sign command and groups |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
583 sign place 5 line=10 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
584 sign place 5 group=g1 line=10 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
585 sign place 5 group=g2 line=10 name=sign1 file=Xsign |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
586 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
587 " Test for :sign place group={group} file={fname} |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
588 let a = execute('sign place file=Xsign') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
589 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
|
590 |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
591 let a = execute('sign place group=g2 file=Xsign') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
592 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
|
593 |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
594 let a = execute('sign place group=* file=Xsign') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
595 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
|
596 \ " 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
|
597 \ " 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
|
598 \ " 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
|
599 |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
600 let a = execute('sign place group=xyz file=Xsign') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
601 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
|
602 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
603 call sign_unplace('*') |
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 " 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
|
606 let bnum = bufnr('Xsign') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
607 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
|
608 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
|
609 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
|
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 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 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
|
613 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
614 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
|
615 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
|
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=* 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" . |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
619 \ " 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
|
620 \ " 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
|
621 \ " 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
|
622 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
623 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
|
624 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
|
625 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
626 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
|
627 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
|
628 \ " 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
|
629 \ " 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
|
630 \ " 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
|
631 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
632 " Test for :sign unplace |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
633 sign unplace 5 group=g2 file=Xsign |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
634 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
|
635 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
636 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
|
637 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
|
638 |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
639 sign unplace 5 group=xy file=Xsign |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
640 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
|
641 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
642 " Test for removing all the signs. Place the signs again for this test |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
643 sign place 5 group=g1 line=11 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
644 sign place 5 group=g2 line=12 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
645 sign place 6 line=20 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
646 sign place 6 group=g1 line=21 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
647 sign place 6 group=g2 line=22 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
648 sign unplace 5 group=* file=Xsign |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
649 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
|
650 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
|
651 \ " 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
|
652 \ " 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
|
653 \ " 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
|
654 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
655 " Remove all the signs from the global group |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
656 sign unplace * file=Xsign |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
657 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
|
658 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
|
659 \ " 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
|
660 \ " 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
|
661 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
662 " Remove all the signs from a particular group |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
663 sign place 5 line=10 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
664 sign place 5 group=g1 line=11 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
665 sign place 5 group=g2 line=12 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
666 sign unplace * group=g1 file=Xsign |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
667 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
|
668 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
|
669 \ " 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
|
670 \ " 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
|
671 \ " 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
|
672 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
673 " Remove all the signs from all the groups in a file |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
674 sign place 5 group=g1 line=11 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
675 sign place 6 line=20 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
676 sign place 6 group=g1 line=21 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
677 sign unplace * group=* file=Xsign |
15209
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 a group from all the files |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
682 sign place 5 group=g1 line=11 name=sign1 file=Xsign |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
683 sign unplace 5 group=g1 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
684 let a = execute('sign place group=*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
685 call assert_equal("\n--- Signs ---\n", a) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
686 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
687 " Remove a particular sign id in all the groups from all the files |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
688 sign place 5 line=10 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
689 sign place 5 group=g1 line=11 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
690 sign place 5 group=g2 line=12 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
691 sign place 6 line=20 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
692 sign place 6 group=g1 line=21 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
693 sign place 6 group=g2 line=22 name=sign1 file=Xsign |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
694 sign unplace 5 group=* |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
695 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
|
696 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
|
697 \ " 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
|
698 \ " 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
|
699 \ " 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
|
700 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
701 " Remove all the signs from all the groups in all the files |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
702 sign place 5 line=10 name=sign1 file=Xsign |
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
703 sign place 5 group=g1 line=11 name=sign1 file=Xsign |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
704 sign unplace * group=* |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
705 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
|
706 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
|
707 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
708 " Error cases |
15247
336728a577f5
patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
709 call assert_fails("sign place 3 group= name=sign1 buffer=" . bnum, 'E474:') |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
710 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
711 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
712 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
713 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
714 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
715 endfunc |
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 " 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
|
718 func Test_sign_id_autogen() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
719 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
720 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
721 call sign_undefine() |
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 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
|
724 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
|
725 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
726 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
|
727 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
728 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
729 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
|
730 \ {'lnum' : 10})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
731 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
|
732 \ {'lnum' : 12})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
733 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
|
734 \ {'lnum' : 14})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
735 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
|
736 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
|
737 \ {'lnum' : 12})) |
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 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
|
740 \ {'lnum' : 11})) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
741 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
|
742 call assert_equal(10, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
743 \ 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
|
744 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
745 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
746 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
747 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
748 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
749 endfunc |
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 " Test for sign priority |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
752 func Test_sign_priority() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
753 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
754 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
755 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
756 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
757 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
|
758 call sign_define("sign1", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
759 call sign_define("sign2", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
760 call sign_define("sign3", attr) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
761 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
762 " 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
|
763 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
|
764 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
765 let fname = fnamemodify('Xsign', ':p') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
766 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
767 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
|
768 \ {'lnum' : 11, 'priority' : 50}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
769 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
|
770 \ {'lnum' : 11, 'priority' : 100}) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
771 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
|
772 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
|
773 call assert_equal([ |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
774 \ {'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
|
775 \ 'priority' : 100}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
776 \ {'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
|
777 \ 'priority' : 50}, |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
778 \ {'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
|
779 \ 'priority' : 10}], |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
780 \ s[0].signs) |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
781 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
782 " Error case |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
783 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
|
784 \ [])", 'E715:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
785 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
786 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
787 " 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
|
788 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
|
789 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
|
790 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
|
791 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
|
792 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
|
793 \ " 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
|
794 \ " 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
|
795 \ " 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
|
796 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
797 " 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
|
798 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
|
799 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
|
800 \ " 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
|
801 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
802 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
803 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
804 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
805 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
806 endfunc |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
807 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
808 " 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
|
809 func Test_sign_memfailures() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
810 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
|
811 edit Xsign |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
812 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
813 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
|
814 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
|
815 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
|
816 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
|
817 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
|
818 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
|
819 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
|
820 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
821 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
|
822 call sign_define("sign1", attr) |
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_getlist'), 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_getdefined("sign1")', '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 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
|
827 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
|
828 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
|
829 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
|
830 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
|
831 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
832 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
|
833 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
|
834 \ 'E342:') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
835 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
836 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
|
837 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
|
838 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
|
839 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
|
840 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
|
841 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
|
842 \ '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
|
843 |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
844 call sign_unplace('*') |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
845 call sign_undefine() |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
846 enew | only |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
847 call delete("Xsign") |
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15156
diff
changeset
|
848 endfunc |