comparison src/testdir/test_matchadd_conceal.vim @ 15406:63b02fcf1361 v8.1.0711

patch 8.1.0711: test files still use function! commit https://github.com/vim/vim/commit/1e1153600c0377472d62cc553173fe555ddcf5a7 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 9 23:01:02 2019 +0100 patch 8.1.0711: test files still use function! Problem: Test files still use function!. Solution: Remove the exclamation mark. Fix overwriting a function.
author Bram Moolenaar <Bram@vim.org>
date Wed, 09 Jan 2019 23:15:05 +0100
parents 81c348d40312
children f38fcbf343ce
comparison
equal deleted inserted replaced
15405:3a8785d45112 15406:63b02fcf1361
7 set term=ansi 7 set term=ansi
8 endif 8 endif
9 9
10 source shared.vim 10 source shared.vim
11 11
12 function! Test_simple_matchadd() 12 func Test_simple_matchadd()
13 new 13 new
14 14
15 1put='# This is a Test' 15 1put='# This is a Test'
16 " 1234567890123456 16 " 1234567890123456
17 let expect = '# This is a Test' 17 let expect = '# This is a Test'
27 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) 27 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
28 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) 28 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
29 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) 29 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
30 30
31 quit! 31 quit!
32 endfunction 32 endfunc
33 33
34 function! Test_simple_matchadd_and_conceal() 34 func Test_simple_matchadd_and_conceal()
35 new 35 new
36 setlocal concealcursor=n conceallevel=1 36 setlocal concealcursor=n conceallevel=1
37 37
38 1put='# This is a Test' 38 1put='# This is a Test'
39 " 1234567890123456 39 " 1234567890123456
49 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10)) 49 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
50 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) 50 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
51 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) 51 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
52 52
53 quit! 53 quit!
54 endfunction 54 endfunc
55 55
56 function! Test_matchadd_and_conceallevel_3() 56 func Test_matchadd_and_conceallevel_3()
57 new 57 new
58 58
59 setlocal conceallevel=3 59 setlocal conceallevel=3
60 " set filetype and :syntax on to change screenattr() 60 " set filetype and :syntax on to change screenattr()
61 setlocal filetype=conf 61 setlocal filetype=conf
90 call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 16)) 90 call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 16))
91 call assert_notequal(screenattr(lnum, 10), screenattr(lnum, 16)) 91 call assert_notequal(screenattr(lnum, 10), screenattr(lnum, 16))
92 92
93 syntax off 93 syntax off
94 quit! 94 quit!
95 endfunction 95 endfunc
96 96
97 function! Test_default_conceal_char() 97 func Test_default_conceal_char()
98 new 98 new
99 setlocal concealcursor=n conceallevel=1 99 setlocal concealcursor=n conceallevel=1
100 100
101 1put='# This is a Test' 101 1put='# This is a Test'
102 " 1234567890123456 102 " 1234567890123456
126 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) 126 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
127 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) 127 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
128 128
129 let &listchars = listchars_save 129 let &listchars = listchars_save
130 quit! 130 quit!
131 endfunction 131 endfunc
132 132
133 function! Test_syn_and_match_conceal() 133 func Test_syn_and_match_conceal()
134 new 134 new
135 setlocal concealcursor=n conceallevel=1 135 setlocal concealcursor=n conceallevel=1
136 136
137 1put='# This is a Test' 137 1put='# This is a Test'
138 " 1234567890123456 138 " 1234567890123456
162 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) 162 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
163 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) 163 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
164 164
165 syntax off 165 syntax off
166 quit! 166 quit!
167 endfunction 167 endfunc
168 168
169 function! Test_clearmatches() 169 func Test_clearmatches()
170 new 170 new
171 setlocal concealcursor=n conceallevel=1 171 setlocal concealcursor=n conceallevel=1
172 172
173 1put='# This is a Test' 173 1put='# This is a Test'
174 " 1234567890123456 174 " 1234567890123456
201 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12)) 201 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
202 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16)) 202 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
203 call assert_equal({'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 'id': a[0].id, 'conceal': 'Z'}, a[0]) 203 call assert_equal({'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 'id': a[0].id, 'conceal': 'Z'}, a[0])
204 204
205 quit! 205 quit!
206 endfunction 206 endfunc
207 207
208 function! Test_using_matchaddpos() 208 func Test_using_matchaddpos()
209 new 209 new
210 setlocal concealcursor=n conceallevel=1 210 setlocal concealcursor=n conceallevel=1
211 " set filetype and :syntax on to change screenattr() 211 " set filetype and :syntax on to change screenattr()
212 setlocal filetype=conf 212 setlocal filetype=conf
213 syntax on 213 syntax on
232 call assert_equal(screenattr(lnum, 12), screenattr(lnum, 16)) 232 call assert_equal(screenattr(lnum, 12), screenattr(lnum, 16))
233 call assert_equal({'group': 'Conceal', 'id': a[0].id, 'priority': 10, 'pos1': [2, 2, 6], 'conceal': 'P'}, a[0]) 233 call assert_equal({'group': 'Conceal', 'id': a[0].id, 'priority': 10, 'pos1': [2, 2, 6], 'conceal': 'P'}, a[0])
234 234
235 syntax off 235 syntax off
236 quit! 236 quit!
237 endfunction 237 endfunc
238 238
239 function! Test_matchadd_repeat_conceal_with_syntax_off() 239 func Test_matchadd_repeat_conceal_with_syntax_off()
240 new 240 new
241 241
242 " To test targets in the same line string is replaced with conceal char 242 " To test targets in the same line string is replaced with conceal char
243 " correctly, repeat 'TARGET' 243 " correctly, repeat 'TARGET'
244 1put ='TARGET_TARGETTARGET' 244 1put ='TARGET_TARGETTARGET'
251 251
252 redraw 252 redraw
253 call assert_equal('t_tt', Screenline(2)) 253 call assert_equal('t_tt', Screenline(2))
254 254
255 quit! 255 quit!
256 endfunction 256 endfunc
257 257
258 function! Test_matchadd_and_syn_conceal() 258 func Test_matchadd_and_syn_conceal()
259 new 259 new
260 let cnt='Inductive bool : Type := | true : bool | false : bool.' 260 let cnt='Inductive bool : Type := | true : bool | false : bool.'
261 let expect = 'Inductive - : Type := | true : - | false : -.' 261 let expect = 'Inductive - : Type := | true : - | false : -.'
262 0put =cnt 262 0put =cnt
263 " set filetype and :syntax on to change screenattr() 263 " set filetype and :syntax on to change screenattr()
274 redraw! 274 redraw!
275 call assert_equal(expect, Screenline(1)) 275 call assert_equal(expect, Screenline(1))
276 call assert_notequal(screenattr(1, 10) , screenattr(1, 11)) 276 call assert_notequal(screenattr(1, 10) , screenattr(1, 11))
277 call assert_notequal(screenattr(1, 11) , screenattr(1, 12)) 277 call assert_notequal(screenattr(1, 11) , screenattr(1, 12))
278 call assert_equal(screenattr(1, 11) , screenattr(1, 32)) 278 call assert_equal(screenattr(1, 11) , screenattr(1, 32))
279 endfunction 279 endfunc