Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved test coverage of syntax.c #1624

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/testdir/test_cmdline.vim
Expand Up @@ -65,6 +65,10 @@ func Test_highlight_completion()
hi Aardig ctermfg=green
call feedkeys(":hi \<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"hi Aardig', getreg(':'))
call feedkeys(":hi default \<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"hi default Aardig', getreg(':'))
call feedkeys(":hi clear Aa\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"hi clear Aardig', getreg(':'))
call feedkeys(":hi li\<S-Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"hi link', getreg(':'))
call feedkeys(":hi d\<S-Tab>\<Home>\"\<CR>", 'xt')
Expand Down
25 changes: 24 additions & 1 deletion src/testdir/test_syntax.vim
Expand Up @@ -304,12 +304,18 @@ 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:')
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()
Expand Down Expand Up @@ -378,3 +384,20 @@ func Test_ownsyntax_completion()
call feedkeys(":ownsyntax java\<C-A>\<C-B>\"\<CR>", '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