Skip to content

Commit

Permalink
patch 8.0.0558: :ownsyntax is not tested
Browse files Browse the repository at this point in the history
Problem:    The :ownsyntax command is not tested.
Solution:   Add a test. (Dominique Pelle, closes #1622)
  • Loading branch information
brammool committed Apr 9, 2017
1 parent 59053e1 commit f8ec998
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/testdir/test_syntax.vim
Expand Up @@ -349,3 +349,32 @@ func Test_invalid_name()
hi clear Nop
hi clear @Wrong
endfunc

func Test_ownsyntax()
new Xfoo
call setline(1, '#define FOO')
syntax on
set filetype=c
ownsyntax perl
call assert_equal('perlComment', synIDattr(synID(line('.'), col('.'), 1), 'name'))
call assert_equal('c', b:current_syntax)
call assert_equal('perl', w:current_syntax)

" A new split window should have the original syntax.
split
call assert_equal('cDefine', synIDattr(synID(line('.'), col('.'), 1), 'name'))
call assert_equal('c', b:current_syntax)
call assert_equal(0, exists('w:current_syntax'))

wincmd x
call assert_equal('perlComment', synIDattr(synID(line("."), col("."), 1), "name"))

syntax off
set filetype&
%bw!
endfunc

func Test_ownsyntax_completion()
call feedkeys(":ownsyntax java\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"ownsyntax java javacc javascript', @:)
endfunc
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -764,6 +764,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
558,
/**/
557,
/**/
Expand Down

0 comments on commit f8ec998

Please sign in to comment.