diff 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
line wrap: on
line diff
--- a/src/testdir/test_syntax.vim
+++ b/src/testdir/test_syntax.vim
@@ -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