patch 8.2.1432: various inconsistencies in test files
Problem: Various inconsistencies in test files.
Solution: Add modelines where they were missing. Use Check commands instead
of silently skipping over tests. Adjust indents and comments.
(Ken Takata, closes #6695)
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 539b782..266513e 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -86,9 +86,7 @@
endfunc
func Test_map_completion()
- if !has('cmdline_compl')
- return
- endif
+ CheckFeature cmdline_compl
call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <unique> <silent>', getreg(':'))
call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt')
@@ -164,9 +162,7 @@
endfunc
func Test_match_completion()
- if !has('cmdline_compl')
- return
- endif
+ CheckFeature cmdline_compl
hi Aardig ctermfg=green
call feedkeys(":match \<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"match Aardig', getreg(':'))
@@ -175,9 +171,7 @@
endfunc
func Test_highlight_completion()
- if !has('cmdline_compl')
- return
- endif
+ CheckFeature cmdline_compl
hi Aardig ctermfg=green
call feedkeys(":hi \<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"hi Aardig', getreg(':'))
@@ -214,9 +208,7 @@
endfunc
func Test_getcompletion()
- if !has('cmdline_compl')
- return
- endif
+ CheckFeature cmdline_compl
let groupcount = len(getcompletion('', 'event'))
call assert_true(groupcount > 0)
let matchcount = len('File'->getcompletion('event'))
@@ -527,9 +519,7 @@
endfunc
func Test_cmdline_keymap_ctrl_hat()
- if !has('keymap')
- return
- endif
+ CheckFeature keymap
set keymap=esperanto
call feedkeys(":\"Jxauxdo \<C-^>Jxauxdo \<C-^>Jxauxdo\<CR>", 'tx')
@@ -596,8 +586,7 @@
call feedkeys(':e ~' . first_letter . "\<c-a>\<c-B>\"\<cr>", 'tx')
call assert_match('^"e \~.*\<' . whoami . '\>', @:)
endif
- endif
- if has('win32')
+ elseif has('win32')
" Just in case: check that the system has an Administrator account.
let names = system('net user')
if names =~ 'Administrator'
@@ -606,14 +595,15 @@
call feedkeys(':e ~A' . "\<c-a>\<c-B>\"\<cr>", 'tx')
call assert_match('^"e \~.*Administrator', @:)
endif
+ else
+ throw 'Skipped: does not work on this platform'
endif
endfunc
func Test_cmdline_complete_bang()
- if executable('whoami')
- call feedkeys(":!whoam\<C-A>\<C-B>\"\<CR>", 'tx')
- call assert_match('^".*\<whoami\>', @:)
- endif
+ CheckExecutable whoami
+ call feedkeys(":!whoam\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_match('^".*\<whoami\>', @:)
endfunc
func Test_cmdline_complete_languages()
@@ -1256,9 +1246,7 @@
" Test for the :! command
func Test_cmd_bang()
- if !has('unix')
- return
- endif
+ CheckUnix
let lines =<< trim [SCRIPT]
" Test for no previous command