From 245b1ad7fa7c77c9dba9929c7def534cddad3512 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 1 Jun 2018 21:18:08 -0400 Subject: [PATCH] vim-patch:8.0.0558: :ownsyntax is not tested Problem: The :ownsyntax command is not tested. Solution: Add a test. (Dominique Pelle, closes vim/vim#1622) https://github.com/vim/vim/commit/f8ec998613d8037e345f4e7e08460dfc15c528a9 --- src/nvim/testdir/test_syntax.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index 8465fe7d45..7f484aa72f 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -382,3 +382,32 @@ func Test_conceal() set conceallevel& bw! 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\\\"\", 'tx') + call assert_equal('"ownsyntax java javacc javascript', @:) +endfunc