Skip to content

Commit 09de175

Browse files
committed
patch 7.4.2183
Problem: Sign tests are old style. Solution: Turn them into new style tests. (Dominique Pelle)
1 parent 2147746 commit 09de175

6 files changed

Lines changed: 111 additions & 27 deletions

File tree

src/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,6 @@ test1 \
20322032
test_marks \
20332033
test_nested_function \
20342034
test_search_mbyte \
2035-
test_signs \
20362035
test_tagcase \
20372036
test_utf8 \
20382037
test_wordcount \
@@ -2110,10 +2109,11 @@ test_arglist \
21102109
test_regexp_utf8 \
21112110
test_reltime \
21122111
test_ruby \
2113-
test_startup \
21142112
test_searchpos \
21152113
test_set \
2114+
test_signs \
21162115
test_sort \
2116+
test_startup \
21172117
test_stat \
21182118
test_statusline \
21192119
test_syn_attr \

src/testdir/Make_all.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ SCRIPTS_ALL = \
102102
test_marks.out \
103103
test_nested_function.out \
104104
test_search_mbyte.out \
105-
test_signs.out \
106105
test_tagcase.out \
107106
test_utf8.out \
108107
test_wordcount.out \
@@ -184,6 +183,7 @@ NEW_TESTS = test_arglist.res \
184183
test_perl.res \
185184
test_quickfix.res \
186185
test_ruby.res \
186+
test_signs.res \
187187
test_startup.res \
188188
test_stat.res \
189189
test_syntax.res \

src/testdir/test_signs.in

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/testdir/test_signs.ok

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/testdir/test_signs.vim

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
" Test for signs
2+
3+
if !has('signs')
4+
finish
5+
endif
6+
7+
func Test_sign()
8+
new
9+
call setline(1, ['a', 'b', 'c', 'd'])
10+
11+
sign define Sign1 text=x
12+
sign define Sign2 text=y
13+
14+
" Test listing signs.
15+
let a=execute('sign list')
16+
call assert_equal("\nsign Sign1 text=x \nsign Sign2 text=y ", a)
17+
18+
let a=execute('sign list Sign1')
19+
call assert_equal("\nsign Sign1 text=x ", a)
20+
21+
" Place the sign at line 3,then check that we can jump to it.
22+
exe 'sign place 42 line=3 name=Sign1 buffer=' . bufnr('')
23+
1
24+
exe 'sign jump 42 buffer=' . bufnr('')
25+
call assert_equal('c', getline('.'))
26+
27+
" Can't change sign.
28+
call assert_fails("exe 'sign place 43 name=Sign1 buffer=' . bufnr('')", 'E885:')
29+
30+
let a=execute('sign place')
31+
call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n line=3 id=42 name=Sign1\n", a)
32+
33+
" Unplace the sign and try jumping to it again should now fail.
34+
sign unplace 42
35+
1
36+
call assert_fails("exe 'sign jump 42 buffer=' . bufnr('')", 'E157:')
37+
call assert_equal('a', getline('.'))
38+
39+
" Unplace sign on current line.
40+
exe 'sign place 43 line=4 name=Sign2 buffer=' . bufnr('')
41+
4
42+
sign unplace
43+
let a=execute('sign place')
44+
call assert_equal("\n--- Signs ---\n", a)
45+
46+
" Try again to unplace sign on current line, it should fail this time.
47+
call assert_fails('sign unplace', 'E159:')
48+
49+
" Unplace all signs.
50+
exe 'sign place 42 line=3 name=Sign1 buffer=' . bufnr('')
51+
sign unplace *
52+
let a=execute('sign place')
53+
call assert_equal("\n--- Signs ---\n", a)
54+
55+
" After undefining the sign, we should no longer be able to place it.
56+
sign undefine Sign1
57+
sign undefine Sign2
58+
call assert_fails("exe 'sign place 42 line=3 name=Sign1 buffer=' . bufnr('')", 'E155:')
59+
60+
endfunc
61+
62+
func Test_sign_completion()
63+
sign define Sign1 text=x
64+
sign define Sign2 text=y
65+
66+
call feedkeys(":sign \<C-A>\<C-B>\"\<CR>", 'tx')
67+
call assert_equal('"sign define jump list place undefine unplace', @:)
68+
69+
call feedkeys(":sign define Sign \<C-A>\<C-B>\"\<CR>", 'tx')
70+
call assert_equal('"sign define Sign icon= linehl= text= texthl=', @:)
71+
72+
call feedkeys(":sign define Sign linehl=Spell\<C-A>\<C-B>\"\<CR>", 'tx')
73+
call assert_equal('"sign define Sign linehl=SpellBad SpellCap SpellLocal SpellRare', @:)
74+
75+
call feedkeys(":sign undefine \<C-A>\<C-B>\"\<CR>", 'tx')
76+
call assert_equal('"sign undefine Sign1 Sign2', @:)
77+
78+
call feedkeys(":sign place 1 \<C-A>\<C-B>\"\<CR>", 'tx')
79+
call assert_equal('"sign place 1 buffer= file= line= name=', @:)
80+
81+
call feedkeys(":sign place 1 name=\<C-A>\<C-B>\"\<CR>", 'tx')
82+
call assert_equal('"sign place 1 name=Sign1 Sign2', @:)
83+
84+
call feedkeys(":sign unplace 1 \<C-A>\<C-B>\"\<CR>", 'tx')
85+
call assert_equal('"sign unplace 1 buffer= file=', @:)
86+
87+
call feedkeys(":sign list \<C-A>\<C-B>\"\<CR>", 'tx')
88+
call assert_equal('"sign list Sign1 Sign2', @:)
89+
90+
call feedkeys(":sign jump 1 \<C-A>\<C-B>\"\<CR>", 'tx')
91+
call assert_equal('"sign jump 1 buffer= file=', @:)
92+
93+
sign undefine Sign1
94+
sign undefine Sign2
95+
96+
endfunc
97+
98+
func Test_sign_invalid_commands()
99+
call assert_fails('sign', 'E471:')
100+
call assert_fails('sign xxx', 'E160:')
101+
call assert_fails('sign define', 'E156:')
102+
call assert_fails('sign undefine', 'E156:')
103+
call assert_fails('sign list xxx', 'E155:')
104+
call assert_fails('sign place 1 buffer=', 'E158:')
105+
call assert_fails('sign define Sign2 text=', 'E239:')
106+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2183,
766768
/**/
767769
2182,
768770
/**/

0 commit comments

Comments
 (0)