From 245b1ad7fa7c77c9dba9929c7def534cddad3512 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 1 Jun 2018 21:18:08 -0400 Subject: 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(+) (limited to 'src') 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 -- cgit From 9cd75ce73e816bece4b003bf4a9b1fbd7bd68d9e Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 2 Jun 2018 08:19:01 -0400 Subject: oldtests: add conceal check for patch 8.0.0562 --- src/nvim/testdir/test_syntax.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index 7f484aa72f..409598d439 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -304,7 +304,9 @@ endfunc func Test_invalid_arg() call assert_fails('syntax case asdf', 'E390:') - call assert_fails('syntax conceal asdf', 'E390:') + if has('conceal') + call assert_fails('syntax conceal asdf', 'E390:') + endif call assert_fails('syntax spell asdf', 'E390:') endfunc -- cgit From dad7882cac5e0e45c3c0dd645537cde51c2fc7a9 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 2 Jun 2018 08:21:39 -0400 Subject: vim-patch:8.0.0562: not enough test coverage for syntax commands Problem: Not enough test coverage for syntax commands. Solution: Add a few more tests. (Dominique Pelle, closes vim/vim#1624) https://github.com/vim/vim/commit/ea588154d00aec288e48b344b2685e46bea99cd6 --- src/nvim/testdir/test_cmdline.vim | 4 ++++ src/nvim/testdir/test_syntax.vim | 29 ++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index be68e9ff9d..8139f00f0e 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -64,6 +64,10 @@ func Test_highlight_completion() hi Aardig ctermfg=green call feedkeys(":hi \\\"\", 'xt') call assert_equal('"hi Aardig', getreg(':')) + call feedkeys(":hi default \\\"\", 'xt') + call assert_equal('"hi default Aardig', getreg(':')) + call feedkeys(":hi clear Aa\\\"\", 'xt') + call assert_equal('"hi clear Aardig', getreg(':')) call feedkeys(":hi li\\\"\", 'xt') call assert_equal('"hi link', getreg(':')) call feedkeys(":hi d\\\"\", 'xt') diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index 409598d439..cf6da71835 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -301,14 +301,20 @@ func Test_syntax_arg_skipped() syn clear endfunc - -func Test_invalid_arg() + +func Test_syntax_invalid_arg() call assert_fails('syntax case asdf', 'E390:') if has('conceal') call assert_fails('syntax conceal asdf', 'E390:') endif call assert_fails('syntax spell asdf', 'E390:') -endfunc + call assert_fails('syntax clear @ABCD', 'E391:') + call assert_fails('syntax include @Xxx', 'E397:') + call assert_fails('syntax region X start="{"', 'E399:') + call assert_fails('syntax sync x', 'E404:') + call assert_fails('syntax keyword Abc a[', 'E789:') + call assert_fails('syntax keyword Abc a[bc]d', 'E890:') + endfunc func Test_syn_sync() syntax region HereGroup start=/this/ end=/that/ @@ -413,3 +419,20 @@ func Test_ownsyntax_completion() call feedkeys(":ownsyntax java\\\"\", 'tx') call assert_equal('"ownsyntax java javacc javascript', @:) endfunc + +func Test_highlight_invalid_arg() + if has('gui_running') + call assert_fails('hi XXX guifg=xxx', 'E254:') + endif + call assert_fails('hi DoesNotExist', 'E411:') + call assert_fails('hi link', 'E412:') + call assert_fails('hi link a', 'E412:') + call assert_fails('hi link a b c', 'E413:') + call assert_fails('hi XXX =', 'E415:') + call assert_fails('hi XXX cterm', 'E416:') + call assert_fails('hi XXX cterm=', 'E417:') + call assert_fails('hi XXX cterm=DoesNotExist', 'E418:') + call assert_fails('hi XXX ctermfg=DoesNotExist', 'E421:') + call assert_fails('hi XXX xxx=White', 'E423:') +endfunc + -- cgit