Skip to content

Commit f8ec998

Browse files
committed
patch 8.0.0558: :ownsyntax is not tested
Problem: The :ownsyntax command is not tested. Solution: Add a test. (Dominique Pelle, closes #1622)
1 parent 59053e1 commit f8ec998

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/testdir/test_syntax.vim

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,3 +349,32 @@ func Test_invalid_name()
349349
hi clear Nop
350350
hi clear @Wrong
351351
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

src/version.c

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

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
558,
767769
/**/
768770
557,
769771
/**/

0 commit comments

Comments
 (0)