Mercurial > vim
comparison src/testdir/test_syntax.vim @ 10618:4ee16e5e2e26 v8.0.0198
patch 8.0.0198: some syntax arguments take effect even after "if 0"
commit https://github.com/vim/vim/commit/de318c5c35ed0d65fd2a07196cb8acd5ee6d9bf8
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 17 16:27:10 2017 +0100
patch 8.0.0198: some syntax arguments take effect even after "if 0"
Problem: Some syntax arguments take effect even after "if 0". (Taylor
Venable)
Solution: Properly skip the syntax statements. Make "syn case" and "syn
conceal" report the current state. Fix that "syn clear" didn't
reset the conceal flag. Add tests for :syntax skipping properly.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 17 Jan 2017 16:30:05 +0100 |
parents | 1c6db35e3527 |
children | bcacc849852a |
comparison
equal
deleted
inserted
replaced
10617:9a75c8a1b8b1 | 10618:4ee16e5e2e26 |
---|---|
160 call assert_match('^"syn list Boolean Character ', @:) | 160 call assert_match('^"syn list Boolean Character ', @:) |
161 | 161 |
162 call feedkeys(":syn match \<C-A>\<C-B>\"\<CR>", 'tx') | 162 call feedkeys(":syn match \<C-A>\<C-B>\"\<CR>", 'tx') |
163 call assert_match('^"syn match Boolean Character ', @:) | 163 call assert_match('^"syn match Boolean Character ', @:) |
164 endfunc | 164 endfunc |
165 | |
166 func Test_syntax_arg_skipped() | |
167 syn clear | |
168 syntax case ignore | |
169 if 0 | |
170 syntax case match | |
171 endif | |
172 call assert_match('case ignore', execute('syntax case')) | |
173 | |
174 syn keyword Foo foo | |
175 call assert_match('Foo', execute('syntax')) | |
176 syn clear | |
177 call assert_match('case match', execute('syntax case')) | |
178 call assert_notmatch('Foo', execute('syntax')) | |
179 | |
180 if has('conceal') | |
181 syn clear | |
182 syntax conceal on | |
183 if 0 | |
184 syntax conceal off | |
185 endif | |
186 call assert_match('conceal on', execute('syntax conceal')) | |
187 syn clear | |
188 call assert_match('conceal off', execute('syntax conceal')) | |
189 endif | |
190 | |
191 syntax region Tar start=/</ end=/>/ | |
192 if 0 | |
193 syntax region NotTest start=/</ end=/>/ contains=@Spell | |
194 endif | |
195 call assert_match('Tar', execute('syntax')) | |
196 call assert_notmatch('NotTest', execute('syntax')) | |
197 call assert_notmatch('Spell', execute('syntax')) | |
198 | |
199 hi Foo ctermfg=blue | |
200 let a = execute('hi Foo') | |
201 if 0 | |
202 syntax rest | |
203 endif | |
204 call assert_equal(a, execute('hi Foo')) | |
205 | |
206 set ft=tags | |
207 syn off | |
208 if 0 | |
209 syntax enable | |
210 endif | |
211 call assert_match('No Syntax items defined', execute('syntax')) | |
212 syntax enable | |
213 call assert_match('tagComment', execute('syntax')) | |
214 set ft= | |
215 | |
216 syn clear | |
217 if 0 | |
218 syntax include @Spell nothing | |
219 endif | |
220 call assert_notmatch('Spell', execute('syntax')) | |
221 | |
222 syn clear | |
223 syn iskeyword 48-57,$,_ | |
224 call assert_match('48-57,$,_', execute('syntax iskeyword')) | |
225 if 0 | |
226 syn clear | |
227 syn iskeyword clear | |
228 endif | |
229 call assert_match('48-57,$,_', execute('syntax iskeyword')) | |
230 syn iskeyword clear | |
231 call assert_match('not set', execute('syntax iskeyword')) | |
232 syn iskeyword 48-57,$,_ | |
233 syn clear | |
234 call assert_match('not set', execute('syntax iskeyword')) | |
235 | |
236 syn clear | |
237 syn keyword Foo foo | |
238 if 0 | |
239 syn keyword NotAdded bar | |
240 endif | |
241 call assert_match('Foo', execute('syntax')) | |
242 call assert_notmatch('NotAdded', execute('highlight')) | |
243 | |
244 syn clear | |
245 syn keyword Foo foo | |
246 call assert_match('Foo', execute('syntax')) | |
247 call assert_match('Foo', execute('syntax list')) | |
248 call assert_notmatch('Foo', execute('if 0 | syntax | endif')) | |
249 call assert_notmatch('Foo', execute('if 0 | syntax list | endif')) | |
250 | |
251 syn clear | |
252 syn match Fopi /asdf/ | |
253 if 0 | |
254 syn match Fopx /asdf/ | |
255 endif | |
256 call assert_match('Fopi', execute('syntax')) | |
257 call assert_notmatch('Fopx', execute('syntax')) | |
258 | |
259 syn clear | |
260 syn spell toplevel | |
261 call assert_match('spell toplevel', execute('syntax spell')) | |
262 if 0 | |
263 syn spell notoplevel | |
264 endif | |
265 call assert_match('spell toplevel', execute('syntax spell')) | |
266 syn spell notoplevel | |
267 call assert_match('spell notoplevel', execute('syntax spell')) | |
268 syn spell default | |
269 call assert_match('spell default', execute('syntax spell')) | |
270 | |
271 syn clear | |
272 if 0 | |
273 syntax cluster Spell | |
274 endif | |
275 call assert_notmatch('Spell', execute('syntax')) | |
276 | |
277 syn clear | |
278 syn keyword Foo foo | |
279 syn sync ccomment | |
280 syn sync maxlines=5 | |
281 if 0 | |
282 syn sync maxlines=11 | |
283 endif | |
284 call assert_match('on C-style comments', execute('syntax sync')) | |
285 call assert_match('maximal 5 lines', execute('syntax sync')) | |
286 syn clear | |
287 syn keyword Foo foo | |
288 if 0 | |
289 syn sync ccomment | |
290 endif | |
291 call assert_notmatch('on C-style comments', execute('syntax sync')) | |
292 | |
293 syn clear | |
294 endfunc | |
295 |