test/old: use CheckFunction, enable more tests

Some skipped tests have custom error messages.
Use ":CheckFunction" command for standard error message
on missing function.
This commit is contained in:
Jan Edmund Lazo
2021-03-26 23:06:39 -04:00
parent 618b17f575
commit ecd2729658
9 changed files with 38 additions and 40 deletions

View File

@@ -76,7 +76,7 @@ if has('timers')
endfunc endfunc
func Test_OptionSet_modeline() func Test_OptionSet_modeline()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
call test_override('starting', 1) call test_override('starting', 1)
au! OptionSet au! OptionSet
augroup set_tabstop augroup set_tabstop
@@ -507,7 +507,7 @@ func s:AutoCommandOptionSet(match)
endfunc endfunc
func Test_OptionSet() func Test_OptionSet()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
if !has("eval") || !exists("+autochdir") if !has("eval") || !exists("+autochdir")
return return
endif endif
@@ -648,7 +648,7 @@ func Test_OptionSet()
endfunc endfunc
func Test_OptionSet_diffmode() func Test_OptionSet_diffmode()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
call test_override('starting', 1) call test_override('starting', 1)
" 18: Changing an option when entering diff mode " 18: Changing an option when entering diff mode
new new
@@ -682,7 +682,7 @@ func Test_OptionSet_diffmode()
endfunc endfunc
func Test_OptionSet_diffmode_close() func Test_OptionSet_diffmode_close()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
call test_override('starting', 1) call test_override('starting', 1)
" 19: Try to close the current window when entering diff mode " 19: Try to close the current window when entering diff mode
" should not segfault " should not segfault
@@ -1285,9 +1285,9 @@ func Test_autocommand_all_events()
endfunc endfunc
" Test TextChangedI and TextChangedP " Test TextChangedI and TextChangedP
" See test/functional/viml/completion_spec.lua'
func Test_ChangedP() func Test_ChangedP()
" Nvim does not support test_override(). CheckFunction test_override
throw 'skipped: see test/functional/viml/completion_spec.lua'
new new
call setline(1, ['foo', 'bar', 'foobar']) call setline(1, ['foo', 'bar', 'foobar'])
call test_override("char_avail", 1) call test_override("char_avail", 1)
@@ -1350,7 +1350,7 @@ func SetLineOne()
endfunc endfunc
func Test_TextChangedI_with_setline() func Test_TextChangedI_with_setline()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
new new
call test_override('char_avail', 1) call test_override('char_avail', 1)
autocmd TextChangedI <buffer> call SetLineOne() autocmd TextChangedI <buffer> call SetLineOne()

View File

@@ -1,5 +1,6 @@
" Tests for :messages, :echomsg, :echoerr " Tests for :messages, :echomsg, :echoerr
source check.vim
source shared.vim source shared.vim
func Test_messages() func Test_messages()
@@ -77,7 +78,7 @@ func Test_echomsg()
endfunc endfunc
func Test_echoerr() func Test_echoerr()
throw 'skipped: Nvim does not support test_ignore_error()' CheckFunction test_ignore_error
call test_ignore_error('IgNoRe') call test_ignore_error('IgNoRe')
call assert_equal("\nIgNoRe hello", execute(':echoerr "IgNoRe hello"')) call assert_equal("\nIgNoRe hello", execute(':echoerr "IgNoRe hello"'))
call assert_equal("\n12345 IgNoRe", execute(':echoerr 12345 "IgNoRe"')) call assert_equal("\n12345 IgNoRe", execute(':echoerr 12345 "IgNoRe"'))

View File

@@ -871,7 +871,7 @@ func Test_popup_complete_backwards_ctrl_p()
endfunc endfunc
fun! Test_complete_o_tab() fun! Test_complete_o_tab()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
let s:o_char_pressed = 0 let s:o_char_pressed = 0
fun! s:act_on_text_changed() fun! s:act_on_text_changed()

View File

@@ -2660,7 +2660,7 @@ endfunc
" Test for incsearch highlighting of the :vimgrep pattern " Test for incsearch highlighting of the :vimgrep pattern
" This test used to cause "E315: ml_get: invalid lnum" errors. " This test used to cause "E315: ml_get: invalid lnum" errors.
func Test_vimgrep_incsearch() func Test_vimgrep_incsearch()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
enew enew
set incsearch set incsearch
call test_override("char_avail", 1) call test_override("char_avail", 1)

View File

@@ -4,9 +4,9 @@ source shared.vim
source screendump.vim source screendump.vim
source check.vim source check.vim
func Test_search_cmdline()
" See test/functional/legacy/search_spec.lua " See test/functional/legacy/search_spec.lua
throw 'skipped: Nvim does not support test_override()' func Test_search_cmdline()
CheckFunction test_override
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -203,9 +203,9 @@ func Test_search_cmdline()
bw! bw!
endfunc endfunc
func Test_search_cmdline2()
" See test/functional/legacy/search_spec.lua " See test/functional/legacy/search_spec.lua
throw 'skipped: Nvim does not support test_override()' func Test_search_cmdline2()
CheckFunction test_override
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -352,7 +352,7 @@ func Test_searchc()
endfunc endfunc
func Cmdline3_prep() func Cmdline3_prep()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
" need to disable char_avail, " need to disable char_avail,
" so that expansion of commandline works " so that expansion of commandline works
call test_override("char_avail", 1) call test_override("char_avail", 1)
@@ -362,14 +362,13 @@ func Cmdline3_prep()
endfunc endfunc
func Incsearch_cleanup() func Incsearch_cleanup()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
set noincsearch set noincsearch
call test_override("char_avail", 0) call test_override("char_avail", 0)
bw! bw!
endfunc endfunc
func Test_search_cmdline3() func Test_search_cmdline3()
throw 'skipped: Nvim does not support test_override()'
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -383,7 +382,6 @@ func Test_search_cmdline3()
endfunc endfunc
func Test_search_cmdline3s() func Test_search_cmdline3s()
throw 'skipped: Nvim does not support test_override()'
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -410,7 +408,6 @@ func Test_search_cmdline3s()
endfunc endfunc
func Test_search_cmdline3g() func Test_search_cmdline3g()
throw 'skipped: Nvim does not support test_override()'
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -434,7 +431,6 @@ func Test_search_cmdline3g()
endfunc endfunc
func Test_search_cmdline3v() func Test_search_cmdline3v()
throw 'skipped: Nvim does not support test_override()'
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -451,9 +447,9 @@ func Test_search_cmdline3v()
call Incsearch_cleanup() call Incsearch_cleanup()
endfunc endfunc
func Test_search_cmdline4()
" See test/functional/legacy/search_spec.lua " See test/functional/legacy/search_spec.lua
throw 'skipped: Nvim does not support test_override()' func Test_search_cmdline4()
CheckFunction test_override
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -508,7 +504,7 @@ func Test_search_cmdline5()
endfunc endfunc
func Test_search_cmdline7() func Test_search_cmdline7()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
" Test that pressing <c-g> in an empty command line " Test that pressing <c-g> in an empty command line
" does not move the cursor " does not move the cursor
if !exists('+incsearch') if !exists('+incsearch')
@@ -799,7 +795,7 @@ func Test_incsearch_vimgrep_dump()
endfunc endfunc
func Test_keep_last_search_pattern() func Test_keep_last_search_pattern()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -821,7 +817,7 @@ func Test_keep_last_search_pattern()
endfunc endfunc
func Test_word_under_cursor_after_match() func Test_word_under_cursor_after_match()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -841,7 +837,7 @@ func Test_word_under_cursor_after_match()
endfunc endfunc
func Test_subst_word_under_cursor() func Test_subst_word_under_cursor()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -883,7 +879,7 @@ func Test_incsearch_with_change()
endfunc endfunc
func Test_incsearch_cmdline_modifier() func Test_incsearch_cmdline_modifier()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -961,7 +957,7 @@ func Test_incsearch_search_dump()
endfunc endfunc
func Test_incsearch_substitute() func Test_incsearch_substitute()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif
@@ -983,7 +979,7 @@ func Test_incsearch_substitute()
endfunc endfunc
func Test_incsearch_substitute_long_line() func Test_incsearch_substitute_long_line()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
new new
call test_override("char_avail", 1) call test_override("char_avail", 1)
set incsearch set incsearch
@@ -1105,7 +1101,7 @@ func Test_one_error_msg()
endfunc endfunc
func Test_incsearch_add_char_under_cursor() func Test_incsearch_add_char_under_cursor()
throw 'skipped: Nvim does not support test_override()' CheckFunction test_override
if !exists('+incsearch') if !exists('+incsearch')
return return
endif endif

View File

@@ -1,8 +1,7 @@
" Test for signs " Test for signs
if !has('signs') source check.vim
finish CheckFeature signs
endif
source screendump.vim source screendump.vim
@@ -1541,7 +1540,7 @@ endfunc
" Tests for memory allocation failures in sign functions " Tests for memory allocation failures in sign functions
func Test_sign_memfailures() func Test_sign_memfailures()
throw 'skipped: Nvim does not support test_alloc_fail()' CheckFunction test_alloc_fail
call writefile(repeat(["Sun is shining"], 30), "Xsign") call writefile(repeat(["Sun is shining"], 30), "Xsign")
edit Xsign edit Xsign

View File

@@ -93,7 +93,6 @@ function! Test_system_exmode()
endfunc endfunc
func Test_system_with_shell_quote() func Test_system_with_shell_quote()
throw 'skipped: enable after porting method patches'
CheckMSWindows CheckMSWindows
call mkdir('Xdir with spaces', 'p') call mkdir('Xdir with spaces', 'p')
@@ -122,7 +121,8 @@ func Test_system_with_shell_quote()
let msg = printf('shell=%s shellxquote=%s', &shell, &shellxquote) let msg = printf('shell=%s shellxquote=%s', &shell, &shellxquote)
try try
let out = 'echo 123'->system() " let out = 'echo 123'->system()
let out = system('echo 123')
catch catch
call assert_report(printf('%s: %s', msg, v:exception)) call assert_report(printf('%s: %s', msg, v:exception))
continue continue

View File

@@ -317,8 +317,8 @@ endfunc
" Test that the garbage collector isn't triggered if a timer callback invokes " Test that the garbage collector isn't triggered if a timer callback invokes
" vgetc(). " vgetc().
func Test_nocatch_garbage_collect() func Test_nocatch_garbage_collect()
" skipped: Nvim does not support test_garbagecollect_soon(), test_override() CheckFunction test_garbagecollect_soon
return CheckFunction test_override
" 'uptimetime. must be bigger than the timer timeout " 'uptimetime. must be bigger than the timer timeout
set ut=200 set ut=200
call test_garbagecollect_soon() call test_garbagecollect_soon()

View File

@@ -3,6 +3,8 @@
" undo-able pieces. Do that by setting 'undolevels'. " undo-able pieces. Do that by setting 'undolevels'.
" Also tests :earlier and :later. " Also tests :earlier and :later.
source check.vim
func Test_undotree() func Test_undotree()
new new
@@ -135,7 +137,7 @@ func BackOne(expected)
endfunc endfunc
func Test_undo_del_chars() func Test_undo_del_chars()
throw 'skipped: Nvim does not support test_settime()' CheckFunction test_settime
" Setup a buffer without creating undo entries " Setup a buffer without creating undo entries
new new
@@ -330,7 +332,7 @@ func Test_insert_expr()
endfunc endfunc
func Test_undofile_earlier() func Test_undofile_earlier()
throw 'skipped: Nvim does not support test_settime()' CheckFunction test_settime
let t0 = localtime() - 43200 let t0 = localtime() - 43200
call test_settime(t0) call test_settime(t0)