0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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)
This commit is contained in:
Bram Moolenaar
2020-08-12 18:50:36 +02:00
parent c3d6e8a46a
commit 6d91bcb4d2
159 changed files with 946 additions and 877 deletions

View File

@@ -242,11 +242,11 @@ endfunc
func Test_args_with_quote() func Test_args_with_quote()
" Only on Unix can a file name include a double quote. " Only on Unix can a file name include a double quote.
if has('unix') CheckUnix
args \"foobar args \"foobar
call assert_equal('"foobar', argv(0)) call assert_equal('"foobar', argv(0))
%argdelete %argdelete
endif
endfunc endfunc
" Test for 0argadd and 0argedit " Test for 0argadd and 0argedit

View File

@@ -374,3 +374,5 @@ func Test_zz_quit_detected()
" Verify that if a test function ends Vim the test script detects this. " Verify that if a test function ends Vim the test script detects this.
quit quit
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -24,3 +24,5 @@ func Test_set_filename()
call chdir(cwd) call chdir(cwd)
call delete('samples/Xtest') call delete('samples/Xtest')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -70,9 +70,7 @@ if has('timers')
endfunc endfunc
func Test_cursorhold_insert_with_timer_interrupt() func Test_cursorhold_insert_with_timer_interrupt()
if !has('job') CheckFeature job
return
endif
" Need to move the cursor. " Need to move the cursor.
call feedkeys("ggG", "xt") call feedkeys("ggG", "xt")
@@ -535,9 +533,7 @@ func s:AutoCommandOptionSet(match)
endfunc endfunc
func Test_OptionSet() func Test_OptionSet()
if !has("eval") || !exists("+autochdir") CheckOption autochdir
return
endif
badd test_autocmd.vim badd test_autocmd.vim
@@ -1778,12 +1774,11 @@ func Test_nocatch_wipe_all_buffers()
endfunc endfunc
func Test_nocatch_wipe_dummy_buffer() func Test_nocatch_wipe_dummy_buffer()
if has('quickfix') CheckFeature quickfix
" Nasty autocommand: wipe buffer on any event. " Nasty autocommand: wipe buffer on any event.
au * x bwipe au * x bwipe
call assert_fails('lv½ /x', 'E937') call assert_fails('lv½ /x', 'E937')
au! au!
endif
endfunc endfunc
function s:Before_test_dirchanged() function s:Before_test_dirchanged()
@@ -1834,9 +1829,7 @@ function Test_dirchanged_local()
endfunc endfunc
function Test_dirchanged_auto() function Test_dirchanged_auto()
if !exists('+autochdir') CheckOption autochdir
return
endif
call s:Before_test_dirchanged() call s:Before_test_dirchanged()
call test_autochdir() call test_autochdir()
autocmd test_dirchanged DirChanged auto call add(s:li, "auto:") autocmd test_dirchanged DirChanged auto call add(s:li, "auto:")
@@ -2087,9 +2080,8 @@ endfunc
" - FileReadPost decompress the file " - FileReadPost decompress the file
func Test_ReadWrite_Autocmds() func Test_ReadWrite_Autocmds()
" Run this test only on Unix-like systems and if gzip is available " Run this test only on Unix-like systems and if gzip is available
if !has('unix') || !executable("gzip") CheckUnix
return CheckExecutable gzip
endif
" Make $GZIP empty, "-v" would cause trouble. " Make $GZIP empty, "-v" would cause trouble.
let $GZIP = "" let $GZIP = ""

View File

@@ -22,3 +22,5 @@ func Test_autoload_vim9script()
call assert_equal('some', auto9#getsome()) call assert_equal('some', auto9#getsome())
call assert_equal(49, auto9#add42(7)) call assert_equal(49, auto9#add42(7))
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -64,3 +64,5 @@ func Test_balloon_eval_term_visual()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_beval_visual') call delete('XTest_beval_visual')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -17,3 +17,5 @@ func Test_balloon_show_gui()
sleep 10m sleep 10m
call balloon_show('') call balloon_show('')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -27,3 +27,5 @@ endfunc
func Test_behave_error() func Test_behave_error()
call assert_fails('behave x', 'E475:') call assert_fails('behave x', 'E475:')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,5 +1,4 @@
" Test for block inserting " Test for block inserting
"
func Test_blockinsert_indent() func Test_blockinsert_indent()
new new

View File

@@ -46,9 +46,7 @@ endfunc
func Test_breakindent01_vartabs() func Test_breakindent01_vartabs()
" like 01 but with vartabs feature " like 01 but with vartabs feature
if !has("vartabs") CheckFeature vartabs
return
endif
call s:test_windows('setl briopt=min:0 vts=4') call s:test_windows('setl briopt=min:0 vts=4')
let lines = s:screen_lines(line('.'),8) let lines = s:screen_lines(line('.'),8)
let expect = [ let expect = [
@@ -75,9 +73,7 @@ func Test_breakindent02()
endfunc endfunc
func Test_breakindent02_vartabs() func Test_breakindent02_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
" simple breakindent test with showbreak set " simple breakindent test with showbreak set
call s:test_windows('setl briopt=min:0 sbr=>> vts=4') call s:test_windows('setl briopt=min:0 sbr=>> vts=4')
let lines = s:screen_lines(line('.'),8) let lines = s:screen_lines(line('.'),8)
@@ -106,9 +102,7 @@ endfunc
func Test_breakindent03_vartabs() func Test_breakindent03_vartabs()
" simple breakindent test with showbreak set and briopt including sbr " simple breakindent test with showbreak set and briopt including sbr
if !has("vartabs") CheckFeature vartabs
return
endif
call s:test_windows('setl briopt=sbr,min:0 sbr=++ vts=4') call s:test_windows('setl briopt=sbr,min:0 sbr=++ vts=4')
let lines = s:screen_lines(line('.'),8) let lines = s:screen_lines(line('.'),8)
let expect = [ let expect = [
@@ -139,9 +133,7 @@ endfunc
func Test_breakindent04_vartabs() func Test_breakindent04_vartabs()
" breakindent set with min width 18 " breakindent set with min width 18
if !has("vartabs") CheckFeature vartabs
return
endif
call s:test_windows('setl sbr= briopt=min:18 vts=4') call s:test_windows('setl sbr= briopt=min:18 vts=4')
let lines = s:screen_lines(line('.'),8) let lines = s:screen_lines(line('.'),8)
let expect = [ let expect = [
@@ -169,9 +161,7 @@ endfunc
func Test_breakindent05_vartabs() func Test_breakindent05_vartabs()
" breakindent set and shift by 2 " breakindent set and shift by 2
if !has("vartabs") CheckFeature vartabs
return
endif
call s:test_windows('setl briopt=shift:2,min:0 vts=4') call s:test_windows('setl briopt=shift:2,min:0 vts=4')
let lines = s:screen_lines(line('.'),8) let lines = s:screen_lines(line('.'),8)
let expect = [ let expect = [
@@ -198,9 +188,7 @@ endfunc
func Test_breakindent06_vartabs() func Test_breakindent06_vartabs()
" breakindent set and shift by -1 " breakindent set and shift by -1
if !has("vartabs") CheckFeature vartabs
return
endif
call s:test_windows('setl briopt=shift:-1,min:0 vts=4') call s:test_windows('setl briopt=shift:-1,min:0 vts=4')
let lines = s:screen_lines(line('.'),8) let lines = s:screen_lines(line('.'),8)
let expect = [ let expect = [
@@ -227,9 +215,7 @@ func Test_breakindent07()
endfunc endfunc
func Test_breakindent07_vartabs() func Test_breakindent07_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
" breakindent set and shift by 1, Number set sbr=? and briopt:sbr " breakindent set and shift by 1, Number set sbr=? and briopt:sbr
call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n vts=4') call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 cpo+=n vts=4')
let lines = s:screen_lines(line('.'),10) let lines = s:screen_lines(line('.'),10)
@@ -258,9 +244,7 @@ func Test_breakindent07a()
endfunc endfunc
func Test_breakindent07a_vartabs() func Test_breakindent07a_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
" breakindent set and shift by 1, Number set sbr=? and briopt:sbr " breakindent set and shift by 1, Number set sbr=? and briopt:sbr
call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 vts=4') call s:test_windows('setl briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 vts=4')
let lines = s:screen_lines(line('.'),10) let lines = s:screen_lines(line('.'),10)
@@ -293,9 +277,7 @@ func Test_breakindent08()
endfunc endfunc
func Test_breakindent08_vartabs() func Test_breakindent08_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
" breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr
call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4 vts=4') call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list cpo+=n ts=4 vts=4')
" make sure, cache is invalidated! " make sure, cache is invalidated!
@@ -327,9 +309,7 @@ func Test_breakindent08a()
endfunc endfunc
func Test_breakindent08a_vartabs() func Test_breakindent08a_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
" breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr " breakindent set and shift by 1, Number and list set sbr=# and briopt:sbr
call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list vts=4') call s:test_windows('setl briopt=shift:1,sbr,min:0 nu nuw=4 sbr=# list vts=4')
let lines = s:screen_lines(line('.'),10) let lines = s:screen_lines(line('.'),10)
@@ -356,9 +336,7 @@ func Test_breakindent09()
endfunc endfunc
func Test_breakindent09_vartabs() func Test_breakindent09_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
" breakindent set and shift by 1, Number and list set sbr=# " breakindent set and shift by 1, Number and list set sbr=#
call s:test_windows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list vts=4') call s:test_windows('setl briopt=shift:1,min:0 nu nuw=4 sbr=# list vts=4')
let lines = s:screen_lines(line('.'),10) let lines = s:screen_lines(line('.'),10)
@@ -390,9 +368,7 @@ func Test_breakindent10()
endfunc endfunc
func Test_breakindent10_vartabs() func Test_breakindent10_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
" breakindent set, Number set sbr=~ " breakindent set, Number set sbr=~
call s:test_windows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 vts=4') call s:test_windows('setl cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 vts=4')
" make sure, cache is invalidated! " make sure, cache is invalidated!
@@ -421,9 +397,7 @@ func Test_breakindent11()
endfunc endfunc
func Test_breakindent11_vartabs() func Test_breakindent11_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
" test strdisplaywidth() " test strdisplaywidth()
call s:test_windows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 vts=4') call s:test_windows('setl cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4 vts=4')
let text = getline(2) let text = getline(2)
@@ -447,9 +421,7 @@ func Test_breakindent12()
endfunc endfunc
func Test_breakindent12_vartabs() func Test_breakindent12_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
" test breakindent with long indent " test breakindent with long indent
let s:input = "\t\t\t\t\t{" let s:input = "\t\t\t\t\t{"
call s:test_windows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>- vts=4') call s:test_windows('setl breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 list listchars=tab:>- vts=4')
@@ -478,9 +450,7 @@ func Test_breakindent13()
endfunc endfunc
func Test_breakindent13_vartabs() func Test_breakindent13_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
let s:input = "" let s:input = ""
call s:test_windows('setl breakindent briopt=min:10 ts=8 vts=8') call s:test_windows('setl breakindent briopt=min:10 ts=8 vts=8')
vert resize 20 vert resize 20
@@ -512,9 +482,7 @@ func Test_breakindent14()
endfunc endfunc
func Test_breakindent14_vartabs() func Test_breakindent14_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
let s:input = "" let s:input = ""
call s:test_windows('setl breakindent briopt= ts=8 vts=8') call s:test_windows('setl breakindent briopt= ts=8 vts=8')
vert resize 30 vert resize 30
@@ -548,9 +516,7 @@ func Test_breakindent15()
endfunc endfunc
func Test_breakindent15_vartabs() func Test_breakindent15_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
let s:input = "" let s:input = ""
call s:test_windows('setl breakindent briopt= ts=8 sw=8 vts=8') call s:test_windows('setl breakindent briopt= ts=8 sw=8 vts=8')
vert resize 30 vert resize 30
@@ -592,9 +558,7 @@ func Test_breakindent16()
endfunc endfunc
func Test_breakindent16_vartabs() func Test_breakindent16_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
" Check that overlong lines are indented correctly. " Check that overlong lines are indented correctly.
let s:input = "" let s:input = ""
call s:test_windows('setl breakindent briopt=min:0 ts=4 vts=4') call s:test_windows('setl breakindent briopt=min:0 ts=4 vts=4')
@@ -620,9 +584,7 @@ func Test_breakindent16_vartabs()
endfunc endfunc
func Test_breakindent17_vartabs() func Test_breakindent17_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
let s:input = "" let s:input = ""
call s:test_windows('setl breakindent list listchars=tab:<-> showbreak=+++') call s:test_windows('setl breakindent list listchars=tab:<-> showbreak=+++')
call setline(1, "\t" . repeat('a', 63)) call setline(1, "\t" . repeat('a', 63))
@@ -640,9 +602,7 @@ func Test_breakindent17_vartabs()
endfunc endfunc
func Test_breakindent18_vartabs() func Test_breakindent18_vartabs()
if !has("vartabs") CheckFeature vartabs
return
endif
let s:input = "" let s:input = ""
call s:test_windows('setl breakindent list listchars=tab:<->') call s:test_windows('setl breakindent list listchars=tab:<->')
call setline(1, "\t" . repeat('a', 63)) call setline(1, "\t" . repeat('a', 63))

View File

@@ -202,3 +202,5 @@ func Test_appendbufline_redraw()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XscriptMatchCommon') call delete('XscriptMatchCommon')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,4 +1,5 @@
" Tests for the getbufinfo(), getwininfo() and gettabinfo() functions " Tests for the getbufinfo(), getwininfo() and gettabinfo() functions
source check.vim source check.vim
func Test_getbufwintabinfo() func Test_getbufwintabinfo()
@@ -168,3 +169,5 @@ func Test_getbufinfo_lines()
edit Xfoo edit Xfoo
bw! bw!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -191,3 +191,5 @@ func Test_cd_completion()
call delete('XComplDir2', 'd') call delete('XComplDir2', 'd')
call delete('XComplFile') call delete('XComplFile')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -93,3 +93,5 @@ func Test_changedtick_not_incremented_with_write()
bwipe bwipe
call delete(fname) call delete(fname)
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,10 +1,10 @@
" Tests for the changelist functionality " Tests for the changelist functionality
source check.vim
" Tests for the getchangelist() function " Tests for the getchangelist() function
func Test_getchangelist() func Test_getchangelist()
if !has("jumplist") CheckFeature jumplist
return
endif
bwipe! bwipe!
enew enew

View File

@@ -1348,9 +1348,7 @@ endfunction
" This caused a crash, because messages were handled while peeking for a " This caused a crash, because messages were handled while peeking for a
" character. " character.
func Test_exit_cb_wipes_buf() func Test_exit_cb_wipes_buf()
if !has('timers') CheckFeature timers
return
endif
set cursorline lazyredraw set cursorline lazyredraw
call test_override('redraw_flag', 1) call test_override('redraw_flag', 1)
new new

View File

@@ -102,3 +102,5 @@ func Test_checkpath3()
set include& set include&
set includeexpr& set includeexpr&
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,5 +1,4 @@
" Test for cinoptions and cindent " Test for cinoptions and cindent
"
func Test_cino_hash() func Test_cino_hash()
" Test that curbuf->b_ind_hash_comment is correctly reset " Test that curbuf->b_ind_hash_comment is correctly reset

View File

@@ -1,3 +1,5 @@
" Test for CJK linebreak
scriptencoding utf-8 scriptencoding utf-8
func Run_cjk_linebreak_after(rigorous) func Run_cjk_linebreak_after(rigorous)
@@ -95,3 +97,5 @@ func Test_cjk_linebreak_join_punct()
%d_ %d_
endfor endfor
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -30,7 +30,7 @@ endfunc
func Test_client_server() func Test_client_server()
let cmd = GetVimCommand() let cmd = GetVimCommand()
if cmd == '' if cmd == ''
return throw 'GetVimCommand() failed'
endif endif
call Check_X11_Connection() call Check_X11_Connection()

View File

@@ -1,5 +1,5 @@
" Tests for :[count]close! command " Tests for :[count]close! command
func Test_close_count() func Test_close_count()
enew! | only enew! | only
@@ -172,3 +172,5 @@ func Test_winclose_command()
set nohidden set nohidden
only! only!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -86,9 +86,7 @@ func Test_complete_wildmenu()
endfunc endfunc
func Test_map_completion() func Test_map_completion()
if !has('cmdline_compl') CheckFeature cmdline_compl
return
endif
call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt') call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <unique> <silent>', getreg(':')) call assert_equal('"map <unique> <silent>', getreg(':'))
call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt') call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt')
@@ -164,9 +162,7 @@ func Test_map_completion()
endfunc endfunc
func Test_match_completion() func Test_match_completion()
if !has('cmdline_compl') CheckFeature cmdline_compl
return
endif
hi Aardig ctermfg=green hi Aardig ctermfg=green
call feedkeys(":match \<Tab>\<Home>\"\<CR>", 'xt') call feedkeys(":match \<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"match Aardig', getreg(':')) call assert_equal('"match Aardig', getreg(':'))
@@ -175,9 +171,7 @@ func Test_match_completion()
endfunc endfunc
func Test_highlight_completion() func Test_highlight_completion()
if !has('cmdline_compl') CheckFeature cmdline_compl
return
endif
hi Aardig ctermfg=green hi Aardig ctermfg=green
call feedkeys(":hi \<Tab>\<Home>\"\<CR>", 'xt') call feedkeys(":hi \<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"hi Aardig', getreg(':')) call assert_equal('"hi Aardig', getreg(':'))
@@ -214,9 +208,7 @@ func Test_highlight_easter_egg()
endfunc endfunc
func Test_getcompletion() func Test_getcompletion()
if !has('cmdline_compl') CheckFeature cmdline_compl
return
endif
let groupcount = len(getcompletion('', 'event')) let groupcount = len(getcompletion('', 'event'))
call assert_true(groupcount > 0) call assert_true(groupcount > 0)
let matchcount = len('File'->getcompletion('event')) let matchcount = len('File'->getcompletion('event'))
@@ -527,9 +519,7 @@ func Test_cmdline_remove_char()
endfunc endfunc
func Test_cmdline_keymap_ctrl_hat() func Test_cmdline_keymap_ctrl_hat()
if !has('keymap') CheckFeature keymap
return
endif
set keymap=esperanto set keymap=esperanto
call feedkeys(":\"Jxauxdo \<C-^>Jxauxdo \<C-^>Jxauxdo\<CR>", 'tx') call feedkeys(":\"Jxauxdo \<C-^>Jxauxdo \<C-^>Jxauxdo\<CR>", 'tx')
@@ -596,8 +586,7 @@ func Test_cmdline_complete_user_names()
call feedkeys(':e ~' . first_letter . "\<c-a>\<c-B>\"\<cr>", 'tx') call feedkeys(':e ~' . first_letter . "\<c-a>\<c-B>\"\<cr>", 'tx')
call assert_match('^"e \~.*\<' . whoami . '\>', @:) call assert_match('^"e \~.*\<' . whoami . '\>', @:)
endif endif
endif elseif has('win32')
if has('win32')
" Just in case: check that the system has an Administrator account. " Just in case: check that the system has an Administrator account.
let names = system('net user') let names = system('net user')
if names =~ 'Administrator' if names =~ 'Administrator'
@@ -606,14 +595,15 @@ func Test_cmdline_complete_user_names()
call feedkeys(':e ~A' . "\<c-a>\<c-B>\"\<cr>", 'tx') call feedkeys(':e ~A' . "\<c-a>\<c-B>\"\<cr>", 'tx')
call assert_match('^"e \~.*Administrator', @:) call assert_match('^"e \~.*Administrator', @:)
endif endif
else
throw 'Skipped: does not work on this platform'
endif endif
endfunc endfunc
func Test_cmdline_complete_bang() func Test_cmdline_complete_bang()
if executable('whoami') CheckExecutable whoami
call feedkeys(":!whoam\<C-A>\<C-B>\"\<CR>", 'tx') call feedkeys(":!whoam\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_match('^".*\<whoami\>', @:) call assert_match('^".*\<whoami\>', @:)
endif
endfunc endfunc
func Test_cmdline_complete_languages() func Test_cmdline_complete_languages()
@@ -1256,9 +1246,7 @@ endfunc
" Test for the :! command " Test for the :! command
func Test_cmd_bang() func Test_cmd_bang()
if !has('unix') CheckUnix
return
endif
let lines =<< trim [SCRIPT] let lines =<< trim [SCRIPT]
" Test for no previous command " Test for no previous command

View File

@@ -194,3 +194,5 @@ func Test_command_count_4()
tabonly! tabonly!
bwipe! bwipe!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,3 +1,5 @@
" Test for comparators
function Test_Comparators() function Test_Comparators()
try try
let oldisident=&isident let oldisident=&isident
@@ -7,3 +9,5 @@ function Test_Comparators()
let &isident=oldisident let &isident=oldisident
endtry endtry
endfunction endfunction
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -76,3 +76,5 @@ func Test_compiler_error()
call assert_fails('compiler! doesnotexist', 'E666:') call assert_fails('compiler! doesnotexist', 'E666:')
unlet! g:current_compiler unlet! g:current_compiler
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -136,3 +136,5 @@ func Test_crypt_set_key_changes_buffer()
bwipe! bwipe!
call delete('Xtest1.txt') call delete('Xtest1.txt')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -196,3 +196,5 @@ func Test_cursorline_screenline()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete(filename) call delete(filename)
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -21,3 +21,5 @@ func Test_curswant()
enew! enew!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1019,3 +1019,5 @@ func Test_debug_backtrace_level()
call delete('Xtest1.vim') call delete('Xtest1.vim')
call delete('Xtest2.vim') call delete('Xtest2.vim')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -110,3 +110,5 @@ func Test_delete_errors()
call assert_fails('call delete('''')', 'E474:') call assert_fails('call delete('''')', 'E474:')
call assert_fails('call delete(''foo'', 0)', 'E15:') call assert_fails('call delete(''foo'', 0)', 'E15:')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,4 +1,5 @@
" Tests for diff mode " Tests for diff mode
source shared.vim source shared.vim
source screendump.vim source screendump.vim
source check.vim source check.vim
@@ -654,9 +655,8 @@ endfunc
func Test_diffpatch() func Test_diffpatch()
" The patch program on MS-Windows may fail or hang. " The patch program on MS-Windows may fail or hang.
if !executable('patch') || !has('unix') CheckExecutable patch
return CheckUnix
endif
new new
insert insert
*************** ***************

View File

@@ -453,9 +453,7 @@ func Test_digraphs_output()
endfunc endfunc
func Test_loadkeymap() func Test_loadkeymap()
if !has('keymap') CheckFeature keymap
return
endif
new new
set keymap=czech set keymap=czech
set iminsert=0 set iminsert=0
@@ -494,9 +492,7 @@ endfunc
" Test for error in a keymap file " Test for error in a keymap file
func Test_loadkeymap_error() func Test_loadkeymap_error()
if !has('keymap') CheckFeature keymap
return
endif
call assert_fails('loadkeymap', 'E105:') call assert_fails('loadkeymap', 'E105:')
call writefile(['loadkeymap', 'a'], 'Xkeymap') call writefile(['loadkeymap', 'a'], 'Xkeymap')
call assert_fails('source Xkeymap', 'E791:') call assert_fails('source Xkeymap', 'E791:')

View File

@@ -1,4 +1,5 @@
" Test for displaying stuff " Test for displaying stuff
if !has('gui_running') && has('unix') if !has('gui_running') && has('unix')
set term=ansi set term=ansi
endif endif
@@ -243,3 +244,5 @@ func Test_visual_block_scroll()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete(filename) call delete(filename)
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -156,9 +156,8 @@ endfunc
func Test_edit_06() func Test_edit_06()
" Test in diff mode " Test in diff mode
if !has("diff") || !executable("diff") CheckFeature diff
return CheckExecutable diff
endif
new new
call setline(1, ['abc', 'xxx', 'yyy']) call setline(1, ['abc', 'xxx', 'yyy'])
vnew vnew
@@ -416,9 +415,7 @@ func Test_edit_CR()
" Test for <CR> in insert mode " Test for <CR> in insert mode
" basically only in quickfix mode ist tested, the rest " basically only in quickfix mode ist tested, the rest
" has been taken care of by other tests " has been taken care of by other tests
if !has("quickfix") CheckFeature quickfix
return
endif
botright new botright new
call writefile(range(1, 10), 'Xqflist.txt') call writefile(range(1, 10), 'Xqflist.txt')
call setqflist([{'filename': 'Xqflist.txt', 'lnum': 2}]) call setqflist([{'filename': 'Xqflist.txt', 'lnum': 2}])
@@ -446,10 +443,9 @@ func Test_edit_CR()
endfunc endfunc
func Test_edit_CTRL_() func Test_edit_CTRL_()
CheckFeature rightleft
" disabled for Windows builds, why? " disabled for Windows builds, why?
if !has("rightleft") || has("win32") CheckNotMSWindows
return
endif
let _encoding=&encoding let _encoding=&encoding
set encoding=utf-8 set encoding=utf-8
" Test for CTRL-_ " Test for CTRL-_
@@ -951,9 +947,7 @@ func Test_edit_CTRL_Z()
endfunc endfunc
func Test_edit_DROP() func Test_edit_DROP()
if !has("dnd") CheckFeature dnd
return
endif
new new
call setline(1, ['abc def ghi']) call setline(1, ['abc def ghi'])
call cursor(1, 1) call cursor(1, 1)
@@ -967,9 +961,7 @@ func Test_edit_DROP()
endfunc endfunc
func Test_edit_CTRL_V() func Test_edit_CTRL_V()
if has("ebcdic") CheckFeature ebcdic
return
endif
new new
call setline(1, ['abc']) call setline(1, ['abc'])
call cursor(2, 1) call cursor(2, 1)
@@ -1009,12 +1001,11 @@ endfunc
func Test_edit_F21() func Test_edit_F21()
" Pressing <f21> " Pressing <f21>
" sends a netbeans command " sends a netbeans command
if has("netbeans_intg") CheckFeature netbeans_intg
new new
" I have no idea what this is supposed to do :) " I have no idea what this is supposed to do :)
call feedkeys("A\<F21>\<F1>\<esc>", 'tnix') call feedkeys("A\<F21>\<F1>\<esc>", 'tnix')
bw bw
endif
endfunc endfunc
func Test_edit_HOME_END() func Test_edit_HOME_END()
@@ -1095,9 +1086,7 @@ endfunc
func Test_edit_MOUSE() func Test_edit_MOUSE()
" This is a simple test, since we not really using the mouse here " This is a simple test, since we not really using the mouse here
if !has("mouse") CheckFeature mouse
return
endif
10new 10new
call setline(1, range(1, 100)) call setline(1, range(1, 100))
call cursor(1, 1) call cursor(1, 1)
@@ -1366,10 +1355,8 @@ func Test_edit_rightleft()
endfunc endfunc
func Test_edit_complete_very_long_name() func Test_edit_complete_very_long_name()
if !has('unix')
" Long directory names only work on Unix. " Long directory names only work on Unix.
return CheckUnix
endif
let dirname = getcwd() . "/Xdir" let dirname = getcwd() . "/Xdir"
let longdirname = dirname . repeat('/' . repeat('d', 255), 4) let longdirname = dirname . repeat('/' . repeat('d', 255), 4)
@@ -1710,8 +1697,7 @@ endfunc
func Test_edit_hkmap() func Test_edit_hkmap()
CheckFeature rightleft CheckFeature rightleft
if has('win32') && !has('gui') if has('win32') && !has('gui')
" Test fails on the MS-Windows terminal version throw 'Skipped: fails on the MS-Windows terminal version'
return
endif endif
new new

View File

@@ -1,3 +1,5 @@
" Test for environment variables.
scriptencoding utf-8 scriptencoding utf-8
func Test_environ() func Test_environ()
@@ -42,3 +44,5 @@ func Test_external_env()
endif endif
call assert_equal('', result) call assert_equal('', result)
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,3 +1,4 @@
" Test for i_CTRL-W
func Test_erasebackword() func Test_erasebackword()
enew enew
@@ -17,3 +18,5 @@ func Test_erasebackword()
enew! enew!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,17 +1,17 @@
" Test whether glob()/globpath() return correct results with certain escaped " Test whether glob()/globpath() return correct results with certain escaped
" characters. " characters.
source check.vim
func SetUp() func SetUp()
" consistent sorting of file names " consistent sorting of file names
set nofileignorecase set nofileignorecase
endfunction endfunction
function Test_glob() function Test_glob()
if !has('unix')
" This test fails on Windows because of the special characters in the " This test fails on Windows because of the special characters in the
" filenames. Disable the test on non-Unix systems for now. " filenames. Disable the test on non-Unix systems for now.
return CheckUnix
endif
" Execute these commands in the sandbox, so that using the shell fails. " Execute these commands in the sandbox, so that using the shell fails.
" Setting 'shell' to an invalid name causes a memory leak. " Setting 'shell' to an invalid name causes a memory leak.
@@ -31,3 +31,5 @@ function Test_globpath()
sandbox call assert_equal(['sautest/autoload/globone.vim', 'sautest/autoload/globtwo.vim'], sandbox call assert_equal(['sautest/autoload/globone.vim', 'sautest/autoload/globtwo.vim'],
\ 'glob*.vim'->globpath('sautest/autoload', 0, 1)) \ 'glob*.vim'->globpath('sautest/autoload', 0, 1))
endfunction endfunction
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -30,3 +30,5 @@ func Test_ex_equal()
bwipe! bwipe!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -17,3 +17,5 @@ func Test_ex_undo()
call assert_equal(1, line('$')) call assert_equal(1, line('$'))
quit! quit!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -83,3 +83,5 @@ func Test_z_negative_lnum()
call assert_equal(1, line('.')) call assert_equal(1, line('.'))
bwipe! bwipe!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -51,3 +51,5 @@ function Test_exec_while_if()
\ "8", \ "8",
\ "9x"], getline(1, 10)) \ "9x"], getline(1, 10))
endfunction endfunction
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,4 +1,5 @@
" Tests for the exists() function " Tests for the exists() function
func Test_exists() func Test_exists()
augroup myagroup augroup myagroup
autocmd! BufEnter *.my echo "myfile edited" autocmd! BufEnter *.my echo "myfile edited"

View File

@@ -24,3 +24,5 @@ function Test_AutoCommands()
edit testfile2.test edit testfile2.test
call assert_false(exists("#BufEnter#<buffer>")) call assert_false(exists("#BufEnter#<buffer>"))
endfunction endfunction
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -81,3 +81,5 @@ func Test_exiting()
endif endif
call delete('Xtestout') call delete('Xtestout')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,3 +1,5 @@
" Test for expanding dllpath options
func s:test_expand_dllpath(optname) func s:test_expand_dllpath(optname)
let $TEST_EXPAND_DLLPATH = '/dllpath/lib' . substitute(a:optname, '\zedll$', '.', '') let $TEST_EXPAND_DLLPATH = '/dllpath/lib' . substitute(a:optname, '\zedll$', '.', '')
execute 'let dllpath_save = &' . a:optname execute 'let dllpath_save = &' . a:optname
@@ -30,3 +32,5 @@ call s:generate_test_if_exists('pythondll')
call s:generate_test_if_exists('pythonthreedll') call s:generate_test_if_exists('pythonthreedll')
call s:generate_test_if_exists('rubydll') call s:generate_test_if_exists('rubydll')
call s:generate_test_if_exists('tcldll') call s:generate_test_if_exists('tcldll')
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -32,3 +32,5 @@ func Test_strcharpart()
call assert_equal('̀', strcharpart('àxb', 1, 1)) call assert_equal('̀', strcharpart('àxb', 1, 1))
call assert_equal('x', strcharpart('àxb', 2, 1)) call assert_equal('x', strcharpart('àxb', 2, 1))
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -12,3 +12,5 @@ func Test_feedkeys_x_with_empty_string()
call assert_equal('foo', getline('.')) call assert_equal('foo', getline('.'))
quit! quit!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -7,10 +7,11 @@
" "
" cksum is part of POSIX and so should be available on most Unixes. " cksum is part of POSIX and so should be available on most Unixes.
" If it isn't available then the test will be skipped. " If it isn't available then the test will be skipped.
source check.vim
func Test_File_Size() func Test_File_Size()
if !executable('cksum') CheckExecutable cksum
return
endif
new new
set fileformat=unix undolevels=-1 set fileformat=unix undolevels=-1
@@ -56,3 +57,5 @@ func Test_File_Read_Write()
enew! enew!
call delete("Xtest") call delete("Xtest")
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,3 +1,4 @@
" Test for 'fileformat'
" Test behavior of fileformat after bwipeout of last buffer " Test behavior of fileformat after bwipeout of last buffer
func Test_fileformat_after_bw() func Test_fileformat_after_bw()

View File

@@ -189,3 +189,5 @@ func Test_filter_display()
bwipe! bwipe!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -161,3 +161,5 @@ func Test_find_complete()
call delete('Xfind', 'rf') call delete('Xfind', 'rf')
set path& set path&
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -227,3 +227,5 @@ func Test_find_cmd()
call assert_fails('sfind', 'E471:') call assert_fails('sfind', 'E471:')
call assert_fails('tabfind', 'E471:') call assert_fails('tabfind', 'E471:')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,4 +1,5 @@
" Tests for 'fixeol' and 'eol' " Tests for 'fixeol' and 'eol'
func Test_fixeol() func Test_fixeol()
" first write two test files with and without trailing EOL " first write two test files with and without trailing EOL
" use Unix fileformat for consistency " use Unix fileformat for consistency
@@ -46,3 +47,5 @@ func Test_fixeol()
set ff& fixeol& eol& set ff& fixeol& eol&
enew! enew!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,4 +1,5 @@
" Test for flatting list. " Test for flatting list.
func Test_flatten() func Test_flatten()
call assert_fails('call flatten(1)', 'E686:') call assert_fails('call flatten(1)', 'E686:')
call assert_fails('call flatten({})', 'E686:') call assert_fails('call flatten({})', 'E686:')
@@ -79,3 +80,5 @@ func Test_flatten()
call assert_equal([1, 2, 1, 2], flatten(l:x, 2)) call assert_equal([1, 2, 1, 2], flatten(l:x, 2))
call assert_equal([2, l:x], l:y) call assert_equal([2, l:x], l:y)
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,5 +1,5 @@
" Test if fnameescape is correct for special chars like ! " Test if fnameescape is correct for special chars like !
func Test_fnameescape() func Test_fnameescape()
let fname = 'Xspa ce' let fname = 'Xspa ce'
let status = v:false let status = v:false

View File

@@ -557,9 +557,7 @@ endfunc
" test syntax folding " test syntax folding
func Test_fold_syntax() func Test_fold_syntax()
if !has('syntax') CheckFeature syntax
return
endif
enew! enew!
set fdm=syntax fdl=0 set fdm=syntax fdl=0

View File

@@ -1,4 +1,5 @@
" Tests for various functions. " Tests for various functions.
source shared.vim source shared.vim
source check.vim source check.vim
source term_util.vim source term_util.vim
@@ -297,9 +298,7 @@ func Test_strptime()
endfunc endfunc
func Test_resolve_unix() func Test_resolve_unix()
if !has('unix') CheckUnix
return
endif
" Xlink1 -> Xlink2 " Xlink1 -> Xlink2
" Xlink2 -> Xlink3 " Xlink2 -> Xlink3
@@ -349,9 +348,7 @@ func s:normalize_fname(fname)
endfunc endfunc
func Test_resolve_win32() func Test_resolve_win32()
if !has('win32') CheckMSWindows
return
endif
" test for shortcut file " test for shortcut file
if executable('cscript') if executable('cscript')
@@ -1243,13 +1240,13 @@ func Test_Executable()
call assert_equal(1, executable(catcmd)) call assert_equal(1, executable(catcmd))
call assert_equal('/' .. catcmd, catcmd->exepath()) call assert_equal('/' .. catcmd, catcmd->exepath())
bwipe bwipe
else
throw 'Skipped: does not work on this platform'
endif endif
endfunc endfunc
func Test_executable_longname() func Test_executable_longname()
if !has('win32') CheckMSWindows
return
endif
let fname = 'X' . repeat('あ', 200) . '.bat' let fname = 'X' . repeat('あ', 200) . '.bat'
call writefile([], fname) call writefile([], fname)
@@ -1418,14 +1415,13 @@ func Test_inputlist()
endfunc endfunc
func Test_balloon_show() func Test_balloon_show()
if has('balloon_eval') CheckFeature balloon_eval
" This won't do anything but must not crash either. " This won't do anything but must not crash either.
call balloon_show('hi!') call balloon_show('hi!')
if !has('gui_running') if !has('gui_running')
call balloon_show(range(3)) call balloon_show(range(3))
call balloon_show([]) call balloon_show([])
endif endif
endif
endfunc endfunc
func Test_setbufvar_options() func Test_setbufvar_options()
@@ -1654,9 +1650,7 @@ func Test_getchar()
endfunc endfunc
func Test_libcall_libcallnr() func Test_libcall_libcallnr()
if !has('libcall') CheckFeature libcall
return
endif
if has('win32') if has('win32')
let libc = 'msvcrt.dll' let libc = 'msvcrt.dll'

View File

@@ -1,4 +1,5 @@
" Test ga normal command, and :ascii Ex command. " Test ga normal command, and :ascii Ex command.
func Do_ga(c) func Do_ga(c)
call setline(1, a:c) call setline(1, a:c)
let l:a = execute("norm 1goga") let l:a = execute("norm 1goga")

View File

@@ -1,3 +1,5 @@
" Test for getcwd()
func GetCwdInfo(win, tab) func GetCwdInfo(win, tab)
let tab_changed = 0 let tab_changed = 0
let mod = ":t" let mod = ":t"
@@ -262,3 +264,5 @@ function Test_Tab_Local_Cwd()
enew | only | tabonly enew | only | tabonly
new new
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -150,3 +150,5 @@ func Test_get_func()
endfunc endfunc
" get({partial}, {what} [, {default}]) - in test_partial.vim " get({partial}, {what} [, {default}]) - in test_partial.vim
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -30,3 +30,5 @@ func Test_glob2regpat_valid()
call assert_equal('^\\\(foo\|bar\\\)$', glob2regpat('\\{foo,bar\\}')) call assert_equal('^\\\(foo\|bar\\\)$', glob2regpat('\\{foo,bar\\}'))
endif endif
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,3 +1,5 @@
" Test for :global and :vglobal
source check.vim source check.vim
func Test_yank_put_clipboard() func Test_yank_put_clipboard()

View File

@@ -24,10 +24,9 @@ endfunc
" As for non-GUI, a balloon_show() test was already added with patch 8.0.0401 " As for non-GUI, a balloon_show() test was already added with patch 8.0.0401
func Test_balloon_show() func Test_balloon_show()
if has('balloon_eval') CheckFeature balloon_eval
" This won't do anything but must not crash either. " This won't do anything but must not crash either.
call balloon_show('hi!') call balloon_show('hi!')
endif
endfunc endfunc
func Test_colorscheme() func Test_colorscheme()
@@ -177,9 +176,7 @@ func Test_set_background()
endfunc endfunc
func Test_set_balloondelay() func Test_set_balloondelay()
if !exists('+balloondelay') CheckOption balloondelay
return
endif
let balloondelay_saved = &balloondelay let balloondelay_saved = &balloondelay
@@ -214,9 +211,7 @@ func Test_set_balloondelay()
endfunc endfunc
func Test_set_ballooneval() func Test_set_ballooneval()
if !exists('+ballooneval') CheckOption ballooneval
return
endif
let ballooneval_saved = &ballooneval let ballooneval_saved = &ballooneval
@@ -233,9 +228,7 @@ func Test_set_ballooneval()
endfunc endfunc
func Test_set_balloonexpr() func Test_set_balloonexpr()
if !exists('+balloonexpr') CheckOption balloonexpr
return
endif
let balloonexpr_saved = &balloonexpr let balloonexpr_saved = &balloonexpr
@@ -764,7 +757,7 @@ endfunc
func Test_encoding_conversion() func Test_encoding_conversion()
" GTK supports conversion between 'encoding' and "utf-8" " GTK supports conversion between 'encoding' and "utf-8"
if has('gui_gtk') CheckFeature gui_gtk
let encoding_saved = &encoding let encoding_saved = &encoding
set encoding=latin1 set encoding=latin1
@@ -774,7 +767,6 @@ func Test_encoding_conversion()
edit SomeFile edit SomeFile
let &encoding = encoding_saved let &encoding = encoding_saved
endif
endfunc endfunc
func Test_shell_command() func Test_shell_command()

View File

@@ -58,3 +58,5 @@ func Test_set_guioptions_for_p()
throw skipped throw skipped
endif endif
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -207,9 +207,7 @@ func Test_highlight_eol_with_cursorline_vertsplit()
endfunc endfunc
func Test_highlight_eol_with_cursorline_rightleft() func Test_highlight_eol_with_cursorline_rightleft()
if !has('rightleft') CheckFeature rightleft
return
endif
let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
@@ -358,9 +356,7 @@ func Test_highlight_eol_with_cursorline_linewrap()
endfunc endfunc
func Test_highlight_eol_with_cursorline_sign() func Test_highlight_eol_with_cursorline_sign()
if !has('signs') CheckFeature signs
return
endif
let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
@@ -418,9 +414,7 @@ func Test_highlight_eol_with_cursorline_sign()
endfunc endfunc
func Test_highlight_eol_with_cursorline_breakindent() func Test_highlight_eol_with_cursorline_breakindent()
if !has('linebreak') CheckFeature linebreak
return
endif
let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine() let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
@@ -516,9 +510,7 @@ func Test_highlight_eol_on_diff()
endfunc endfunc
func Test_termguicolors() func Test_termguicolors()
if !exists('+termguicolors') CheckOption termguicolors
return
endif
if has('vtp') && !has('vcon') && !has('gui_running') if has('vtp') && !has('vcon') && !has('gui_running')
" Win32: 'guicolors' doesn't work without virtual console. " Win32: 'guicolors' doesn't work without virtual console.
call assert_fails('set termguicolors', 'E954:') call assert_fails('set termguicolors', 'E954:')

View File

@@ -1,5 +1,7 @@
" Test for v:hlsearch " Test for v:hlsearch
source check.vim
func Test_hlsearch() func Test_hlsearch()
new new
call setline(1, repeat(['aaa'], 10)) call setline(1, repeat(['aaa'], 10))
@@ -33,9 +35,7 @@ func Test_hlsearch()
endfunc endfunc
func Test_hlsearch_hangs() func Test_hlsearch_hangs()
if !has('reltime') || !has('float') CheckFunction reltimefloat
return
endif
" This pattern takes a long time to match, it should timeout. " This pattern takes a long time to match, it should timeout.
new new
@@ -63,3 +63,5 @@ func Test_hlsearch_eol_highlight()
set nohlsearch set nohlsearch
bwipe! bwipe!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,3 +1,5 @@
" Test for 'iminsert'
source view_util.vim source view_util.vim
source check.vim source check.vim
@@ -89,8 +91,7 @@ func Test_iminsert_toggle()
CheckFeature xim CheckFeature xim
endif endif
if has('gui_running') && !has('win32') if has('gui_running') && !has('win32')
" this works only in Win32 GUI version (for some reason) throw 'Skipped: works only in Win32 GUI version (for some reason)'
return
endif endif
new new
let save_imdisable = &imdisable let save_imdisable = &imdisable

View File

@@ -1,4 +1,5 @@
" Tests for using Ctrl-A/Ctrl-X using DBCS. " Tests for using Ctrl-A/Ctrl-X using DBCS.
set encoding=cp932 set encoding=cp932
scriptencoding cp932 scriptencoding cp932

View File

@@ -1,3 +1,5 @@
" Test for insert completion
source screendump.vim source screendump.vim
source check.vim source check.vim

View File

@@ -25,3 +25,5 @@ func Test_interrupt()
call assert_equal(0, s:bufwritepost_called) call assert_equal(0, s:bufwritepost_called)
call assert_equal(0, filereadable('Xfile')) call assert_equal(0, filereadable('Xfile'))
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -2,17 +2,16 @@
" leaks under valgrind. That is because when fork/exec fails memory is not " leaks under valgrind. That is because when fork/exec fails memory is not
" freed. Since the process exits right away it's not a real leak. " freed. Since the process exits right away it's not a real leak.
source shared.vim source check.vim
func Test_job_start_fails() func Test_job_start_fails()
if has('job') CheckFeature job
let job = job_start('axdfxsdf') let job = job_start('axdfxsdf')
if has('unix') if has('unix')
call WaitForAssert({-> assert_equal("dead", job_status(job))}) call WaitForAssert({-> assert_equal("dead", job_status(job))})
else else
call WaitForAssert({-> assert_equal("fail", job_status(job))}) call WaitForAssert({-> assert_equal("fail", job_status(job))})
endif endif
endif
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -444,3 +444,5 @@ func Test_join_lines()
call assert_equal(['a', 'b c'], getline(1, '$')) call assert_equal(['a', 'b c'], getline(1, '$'))
bwipe! bwipe!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -323,3 +323,5 @@ func Test_json_encode_long()
let json = json_encode([repeat('a', 3996)]) let json = json_encode([repeat('a', 3996)])
call assert_equal(4000, len(json)) call assert_equal(4000, len(json))
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,10 +1,10 @@
" Tests for the jumplist functionality " Tests for the jumplist functionality
source check.vim
" Tests for the getjumplist() function " Tests for the getjumplist() function
func Test_getjumplist() func Test_getjumplist()
if !has("jumplist") CheckFeature jumplist
return
endif
%bwipe %bwipe
clearjumps clearjumps
@@ -64,3 +64,5 @@ func Test_getjumplist()
call delete("Xtest") call delete("Xtest")
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,3 +1,5 @@
" Test for '' mark in an empty buffer
func Test_empty_buffer() func Test_empty_buffer()
new new
insert insert
@@ -9,3 +11,5 @@ d
call assert_equal(1, line("''")) call assert_equal(1, line("''"))
bwipe! bwipe!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,5 +1,7 @@
" Test for lambda and closure " Test for lambda and closure
source check.vim
func Test_lambda_feature() func Test_lambda_feature()
call assert_equal(1, has('lambda')) call assert_equal(1, has('lambda'))
endfunc endfunc
@@ -19,9 +21,7 @@ func Test_lambda_with_sort()
endfunc endfunc
func Test_lambda_with_timer() func Test_lambda_with_timer()
if !has('timers') CheckFeature timers
return
endif
let s:n = 0 let s:n = 0
let s:timer_id = 0 let s:timer_id = 0

View File

@@ -52,3 +52,5 @@ func Test_langmap()
set langmap& set langmap&
quit! quit!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -27,3 +27,5 @@ func Test_largefile()
call assert_true(fsize == 4000000000) call assert_true(fsize == 4000000000)
call delete(fname) call delete(fname)
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,5 +1,6 @@
" Tests for saving/loading a file with some lines ending in " Tests for saving/loading a file with some lines ending in
" CTRL-M, some not " CTRL-M, some not
func Test_lineending() func Test_lineending()
let l = ["this line ends in a\<CR>", let l = ["this line ends in a\<CR>",
\ "this one doesn't", \ "this one doesn't",
@@ -17,3 +18,5 @@ func Test_lineending()
new | only new | only
call delete('Xfile1') call delete('Xfile1')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -204,3 +204,5 @@ func Test_listchars_composing()
enew! enew!
set listchars& ff& set listchars& ff&
endfunction endfunction
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -369,3 +369,5 @@ func Test_col_after_deletion_moved_cur()
bwipe! bwipe!
delfunc Listener delfunc Listener
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -263,4 +263,6 @@ func Test_list_with_tab_and_skipping_first_chars()
\ ] \ ]
call s:compare_lines(expect, lines) call s:compare_lines(expect, lines)
call s:close_windows() call s:close_windows()
endfu endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -269,4 +269,6 @@ func Test_chinese_char_on_wrap_column()
let lines = s:screen_lines([1, 10], winwidth(0)) let lines = s:screen_lines([1, 10], winwidth(0))
call s:compare_lines(expect, lines) call s:compare_lines(expect, lines)
call s:close_windows() call s:close_windows()
endfu endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -102,3 +102,5 @@ func Test_make()
lclose lclose
endfor endfor
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -131,3 +131,5 @@ func Test_keep_unnamed_register()
%bw! %bw!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -92,9 +92,7 @@ func Test_map_ctrl_c_visual()
endfunc endfunc
func Test_map_langmap() func Test_map_langmap()
if !has('langmap') CheckFeature langmap
return
endif
" check langmap applies in normal mode " check langmap applies in normal mode
set langmap=+- nolangremap set langmap=+- nolangremap
@@ -259,9 +257,7 @@ func Test_abbr_after_line_join()
endfunc endfunc
func Test_map_timeout() func Test_map_timeout()
if !has('timers') CheckFeature timers
return
endif
nnoremap aaaa :let got_aaaa = 1<CR> nnoremap aaaa :let got_aaaa = 1<CR>
nnoremap bb :let got_bb = 1<CR> nnoremap bb :let got_bb = 1<CR>
nmap b aaa nmap b aaa
@@ -290,9 +286,8 @@ func Test_map_timeout()
endfunc endfunc
func Test_map_timeout_with_timer_interrupt() func Test_map_timeout_with_timer_interrupt()
if !has('job') || !has('timers') CheckFeature job
return CheckFeature timers
endif
" Confirm the timer invoked in exit_cb of the job doesn't disturb mapped key " Confirm the timer invoked in exit_cb of the job doesn't disturb mapped key
" sequence. " sequence.

View File

@@ -1,3 +1,4 @@
" Test for marks
" Test that a deleted mark is restored after delete-undo-redo-undo. " Test that a deleted mark is restored after delete-undo-redo-undo.
func Test_Restore_DelMark() func Test_Restore_DelMark()

View File

@@ -405,3 +405,5 @@ func Test_cursor_column_in_concealed_line_after_leftcol_change()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xcurs-columns') call delete('Xcurs-columns')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -41,3 +41,5 @@ func Test_match_using_multibyte_conceal_char()
quit! quit!
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -162,3 +162,5 @@ func Test_memory_func_capture_lvars()
call vim.stop() call vim.stop()
call delete(testfile) call delete(testfile)
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -62,9 +62,7 @@ func Test_buffer_menu_special_buffers()
endfunc endfunc
func Test_translate_menu() func Test_translate_menu()
if !has('multi_lang') CheckFeature multi_lang
return
endif
if !filereadable($VIMRUNTIME . '/lang/menu_de_de.latin1.vim') if !filereadable($VIMRUNTIME . '/lang/menu_de_de.latin1.vim')
throw 'Skipped: translated menu not found' throw 'Skipped: translated menu not found'
endif endif

View File

@@ -94,9 +94,8 @@ func Test_echoerr()
endfunc endfunc
func Test_mode_message_at_leaving_insert_by_ctrl_c() func Test_mode_message_at_leaving_insert_by_ctrl_c()
if !has('terminal') || has('gui_running') CheckFeature terminal
return CheckNotGui
endif
" Set custom statusline built by user-defined function. " Set custom statusline built by user-defined function.
let testfile = 'Xtest.vim' let testfile = 'Xtest.vim'
@@ -126,9 +125,8 @@ func Test_mode_message_at_leaving_insert_by_ctrl_c()
endfunc endfunc
func Test_mode_message_at_leaving_insert_with_esc_mapped() func Test_mode_message_at_leaving_insert_with_esc_mapped()
if !has('terminal') || has('gui_running') CheckFeature terminal
return CheckNotGui
endif
" Set custom statusline built by user-defined function. " Set custom statusline built by user-defined function.
let testfile = 'Xtest.vim' let testfile = 'Xtest.vim'

View File

@@ -150,10 +150,9 @@ func Test_mksession_large_winheight()
endfunc endfunc
func Test_mksession_rtp() func Test_mksession_rtp()
if has('win32') " TODO: fix problem with backslashes on Win32
" TODO: fix problem with backslashes CheckNotMSWindows
return
endif
new new
let _rtp=&rtp let _rtp=&rtp
" Make a real long (invalid) runtimepath value, " Make a real long (invalid) runtimepath value,
@@ -552,10 +551,9 @@ func Test_mksession_no_errmsg()
endfunc endfunc
func Test_mksession_quote_in_filename() func Test_mksession_quote_in_filename()
if !has('unix')
" only Unix can handle this weird filename " only Unix can handle this weird filename
return CheckUnix
endif
let v:errmsg = '' let v:errmsg = ''
%bwipe! %bwipe!
split another split another
@@ -721,10 +719,9 @@ endfunc
" Test for mksession with window position " Test for mksession with window position
func Test_mksession_winpos() func Test_mksession_winpos()
if !has('gui_running')
" Only applicable in GUI Vim " Only applicable in GUI Vim
return CheckGui
endif
set sessionoptions+=winpos set sessionoptions+=winpos
mksession! Xtest_mks.out mksession! Xtest_mks.out
let found_winpos = v:false let found_winpos = v:false

View File

@@ -1,5 +1,7 @@
" Tests for parsing the modeline. " Tests for parsing the modeline.
source check.vim
func Test_modeline_invalid() func Test_modeline_invalid()
" This was reading allocated memory in the past. " This was reading allocated memory in the past.
call writefile(['vi:0', 'nothing'], 'Xmodeline') call writefile(['vi:0', 'nothing'], 'Xmodeline')
@@ -62,9 +64,7 @@ func Test_modeline_syntax()
endfunc endfunc
func Test_modeline_keymap() func Test_modeline_keymap()
if !has('keymap') CheckFeature keymap
return
endif
call writefile(['vim: set keymap=greek :', 'nothing'], 'Xmodeline_keymap') call writefile(['vim: set keymap=greek :', 'nothing'], 'Xmodeline_keymap')
let modeline = &modeline let modeline = &modeline
set modeline set modeline
@@ -170,9 +170,7 @@ func Test_modeline_colon()
endfunc endfunc
func s:modeline_fails(what, text, error) func s:modeline_fails(what, text, error)
if !exists('+' .. a:what) call CheckOption(a:what)
return
endif
let fname = "Xmodeline_fails_" . a:what let fname = "Xmodeline_fails_" . a:what
call writefile(['vim: set ' . a:text . ' :', 'nothing'], fname) call writefile(['vim: set ' . a:text . ' :', 'nothing'], fname)
let modeline = &modeline let modeline = &modeline
@@ -335,3 +333,5 @@ func Test_modeline_setoption_verbose()
let &modeline = modeline let &modeline = modeline
call delete('Xmodeline') call delete('Xmodeline')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -1,5 +1,7 @@
" Tests for nested functions " Tests for nested functions
"
source check.vim
func NestedFunc() func NestedFunc()
func! Func1() func! Func1()
let g:text .= 'Func1 ' let g:text .= 'Func1 '
@@ -49,9 +51,8 @@ endfunc
func Test_max_nesting() func Test_max_nesting()
" TODO: why does this fail on Windows? Runs out of stack perhaps? " TODO: why does this fail on Windows? Runs out of stack perhaps?
if has('win32') CheckNotMSWindows
return
endif
let call_depth_here = 2 let call_depth_here = 2
let ex_depth_here = 5 let ex_depth_here = 5
set mfd& set mfd&
@@ -65,3 +66,5 @@ func Test_max_nesting()
set mfd& set mfd&
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -297,3 +297,5 @@ func Test_relativenumber_colors()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_relnr') call delete('XTest_relnr')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -136,12 +136,11 @@ func Test_path_keep_commas()
endfunc endfunc
func Test_signcolumn() func Test_signcolumn()
if has('signs') CheckFeature signs
call assert_equal("auto", &signcolumn) call assert_equal("auto", &signcolumn)
set signcolumn=yes set signcolumn=yes
set signcolumn=no set signcolumn=no
call assert_fails('set signcolumn=nope') call assert_fails('set signcolumn=nope')
endif
endfunc endfunc
func Test_filetype_valid() func Test_filetype_valid()
@@ -162,9 +161,7 @@ func Test_filetype_valid()
endfunc endfunc
func Test_syntax_valid() func Test_syntax_valid()
if !has('syntax') CheckFeature syntax
return
endif
set syn=valid_name set syn=valid_name
call assert_equal("valid_name", &syntax) call assert_equal("valid_name", &syntax)
set syn=valid-name set syn=valid-name
@@ -182,9 +179,7 @@ func Test_syntax_valid()
endfunc endfunc
func Test_keymap_valid() func Test_keymap_valid()
if !has('keymap') CheckFeature keymap
return
endif
call assert_fails(":set kmp=valid_name", "E544:") call assert_fails(":set kmp=valid_name", "E544:")
call assert_fails(":set kmp=valid_name", "valid_name") call assert_fails(":set kmp=valid_name", "valid_name")
call assert_fails(":set kmp=valid-name", "E544:") call assert_fails(":set kmp=valid-name", "E544:")

View File

@@ -1,5 +1,6 @@
" Tests for 'packpath' and :packadd " Tests for 'packpath' and :packadd
source check.vim
func SetUp() func SetUp()
let s:topdir = getcwd() . '/Xdir' let s:topdir = getcwd() . '/Xdir'
@@ -115,9 +116,7 @@ func Test_packadd_noload()
endfunc endfunc
func Test_packadd_symlink_dir() func Test_packadd_symlink_dir()
if !has('unix') CheckUnix
return
endif
let top2_dir = s:topdir . '/Xdir2' let top2_dir = s:topdir . '/Xdir2'
let real_dir = s:topdir . '/Xsym' let real_dir = s:topdir . '/Xsym'
call mkdir(real_dir, 'p') call mkdir(real_dir, 'p')
@@ -150,9 +149,7 @@ func Test_packadd_symlink_dir()
endfunc endfunc
func Test_packadd_symlink_dir2() func Test_packadd_symlink_dir2()
if !has('unix') CheckUnix
return
endif
let top2_dir = s:topdir . '/Xdir2' let top2_dir = s:topdir . '/Xdir2'
let real_dir = s:topdir . '/Xsym/pack' let real_dir = s:topdir . '/Xsym/pack'
call mkdir(top2_dir, 'p') call mkdir(top2_dir, 'p')

View File

@@ -1,5 +1,7 @@
" Test binding arguments to a Funcref. " Test binding arguments to a Funcref.
source check.vim
func MyFunc(arg1, arg2, arg3) func MyFunc(arg1, arg2, arg3)
return a:arg1 . '/' . a:arg2 . '/' . a:arg3 return a:arg1 . '/' . a:arg2 . '/' . a:arg3
endfunc endfunc
@@ -235,7 +237,7 @@ func Test_redefine_dict_func()
endfunc endfunc
func Test_bind_in_python() func Test_bind_in_python()
if has('python') CheckFeature python
let g:d = {} let g:d = {}
function g:d.test2() function g:d.test2()
endfunction endfunction
@@ -245,7 +247,6 @@ func Test_bind_in_python()
catch catch
call assert_true(v:false, v:exception) call assert_true(v:false, v:exception)
endtry endtry
endif
endfunc endfunc
" This caused double free on exit if EXITFREE is defined. " This caused double free on exit if EXITFREE is defined.
@@ -270,23 +271,21 @@ func Ignored3(job1, job2, status)
endfunc endfunc
func Test_cycle_partial_job() func Test_cycle_partial_job()
if has('job') CheckFeature job
let job = job_start('echo') let job = job_start('echo')
call job_setoptions(job, {'exit_cb': function('Ignored3', [job])}) call job_setoptions(job, {'exit_cb': function('Ignored3', [job])})
unlet job unlet job
endif
endfunc endfunc
func Ignored2(job, status) func Ignored2(job, status)
endfunc endfunc
func Test_ref_job_partial_dict() func Test_ref_job_partial_dict()
if has('job') CheckFeature job
let g:ref_job = job_start('echo') let g:ref_job = job_start('echo')
let d = {'a': 'b'} let d = {'a': 'b'}
call job_setoptions(g:ref_job, {'exit_cb': function('Ignored2', [], d)}) call job_setoptions(g:ref_job, {'exit_cb': function('Ignored2', [], d)})
call test_garbagecollect_now() call test_garbagecollect_now()
endif
endfunc endfunc
func Test_auto_partial_rebind() func Test_auto_partial_rebind()

View File

@@ -135,9 +135,7 @@ func CheckCopyPaste()
endfunc endfunc
func Test_xrestore() func Test_xrestore()
if !has('xterm_clipboard') CheckFeature xterm_clipboard
return
endif
let display = $DISPLAY let display = $DISPLAY
new new
call CheckCopyPaste() call CheckCopyPaste()

Some files were not shown because too many files have changed in this diff Show More