Mercurial > vim
comparison src/testdir/test_syntax.vim @ 11345:329653a02657 v8.0.0558
patch 8.0.0558: :ownsyntax is not tested
commit https://github.com/vim/vim/commit/f8ec998613d8037e345f4e7e08460dfc15c528a9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 9 15:41:31 2017 +0200
patch 8.0.0558: :ownsyntax is not tested
Problem: The :ownsyntax command is not tested.
Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/1622)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 09 Apr 2017 15:45:03 +0200 |
parents | 918942a3b0ef |
children | 129077fb57e6 |
comparison
equal
deleted
inserted
replaced
11344:62547be9146a | 11345:329653a02657 |
---|---|
347 call assert_match('W18:', execute('1messages')) | 347 call assert_match('W18:', execute('1messages')) |
348 syn clear | 348 syn clear |
349 hi clear Nop | 349 hi clear Nop |
350 hi clear @Wrong | 350 hi clear @Wrong |
351 endfunc | 351 endfunc |
352 | |
353 func Test_ownsyntax() | |
354 new Xfoo | |
355 call setline(1, '#define FOO') | |
356 syntax on | |
357 set filetype=c | |
358 ownsyntax perl | |
359 call assert_equal('perlComment', synIDattr(synID(line('.'), col('.'), 1), 'name')) | |
360 call assert_equal('c', b:current_syntax) | |
361 call assert_equal('perl', w:current_syntax) | |
362 | |
363 " A new split window should have the original syntax. | |
364 split | |
365 call assert_equal('cDefine', synIDattr(synID(line('.'), col('.'), 1), 'name')) | |
366 call assert_equal('c', b:current_syntax) | |
367 call assert_equal(0, exists('w:current_syntax')) | |
368 | |
369 wincmd x | |
370 call assert_equal('perlComment', synIDattr(synID(line("."), col("."), 1), "name")) | |
371 | |
372 syntax off | |
373 set filetype& | |
374 %bw! | |
375 endfunc | |
376 | |
377 func Test_ownsyntax_completion() | |
378 call feedkeys(":ownsyntax java\<C-A>\<C-B>\"\<CR>", 'tx') | |
379 call assert_equal('"ownsyntax java javacc javascript', @:) | |
380 endfunc |