]> granicus.if.org Git - vim/commitdiff
patch 8.0.0558: :ownsyntax is not tested v8.0.0558
authorBram Moolenaar <Bram@vim.org>
Sun, 9 Apr 2017 13:41:31 +0000 (15:41 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 9 Apr 2017 13:41:31 +0000 (15:41 +0200)
Problem:    The :ownsyntax command is not tested.
Solution:   Add a test. (Dominique Pelle, closes #1622)

src/testdir/test_syntax.vim
src/version.c

index 9ebe3f13e8b93cbd1aee58e5d020ea4e93b10969..d4bb25e69e4d35fac06215d43a6b3e45cf2468ac 100644 (file)
@@ -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
index d37033f4e3b150a9a16a857f2b17f324f5e69242..26df6341051fb96270bbc2337f005c0f56239855 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    558,
 /**/
     557,
 /**/