mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.0.0768: too many delete() calls in tests
Problem: Too many delete() calls in tests. Solution: Use deferred delete where possible.
This commit is contained in:
@@ -384,21 +384,18 @@ func Test_undofile_truncated()
|
|||||||
|
|
||||||
" try several sizes
|
" try several sizes
|
||||||
for size in range(20, 500, 33)
|
for size in range(20, 500, 33)
|
||||||
call writefile(contents[0:size], 'Xundofile')
|
call writefile(contents[0:size], 'Xundofile', 'D')
|
||||||
call assert_fails('rundo Xundofile', 'E825:')
|
call assert_fails('rundo Xundofile', 'E825:')
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
call delete('Xundofile')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_rundo_errors()
|
func Test_rundo_errors()
|
||||||
call assert_fails('rundo XfileDoesNotExist', 'E822:')
|
call assert_fails('rundo XfileDoesNotExist', 'E822:')
|
||||||
|
|
||||||
call writefile(['abc'], 'Xundofile')
|
call writefile(['abc'], 'Xundofile', 'D')
|
||||||
call assert_fails('rundo Xundofile', 'E823:')
|
call assert_fails('rundo Xundofile', 'E823:')
|
||||||
|
|
||||||
call delete('Xundofile')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_undofile_next()
|
func Test_undofile_next()
|
||||||
|
@@ -303,7 +303,7 @@ func Test_function_defined_line()
|
|||||||
qall!
|
qall!
|
||||||
[CODE]
|
[CODE]
|
||||||
|
|
||||||
call writefile(lines, 'Xtest.vim')
|
call writefile(lines, 'Xtest.vim', 'D')
|
||||||
let res = system(GetVimCommandClean() .. ' -es -X -S Xtest.vim')
|
let res = system(GetVimCommandClean() .. ' -es -X -S Xtest.vim')
|
||||||
call assert_equal(0, v:shell_error)
|
call assert_equal(0, v:shell_error)
|
||||||
|
|
||||||
@@ -324,8 +324,6 @@ func Test_function_defined_line()
|
|||||||
|
|
||||||
let m = matchstr(res, 'function F6()[^[:print:]]*[[:print:]]*')
|
let m = matchstr(res, 'function F6()[^[:print:]]*[[:print:]]*')
|
||||||
call assert_match(' line 23$', m)
|
call assert_match(' line 23$', m)
|
||||||
|
|
||||||
call delete('Xtest.vim')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for defining a function reference in the global scope
|
" Test for defining a function reference in the global scope
|
||||||
@@ -380,12 +378,11 @@ func Test_script_local_func()
|
|||||||
:qall
|
:qall
|
||||||
|
|
||||||
[CODE]
|
[CODE]
|
||||||
call writefile(lines, 'Xscript')
|
call writefile(lines, 'Xscript', 'D')
|
||||||
if RunVim([], [], '-s Xscript')
|
if RunVim([], [], '-s Xscript')
|
||||||
call assert_equal([], readfile('Xresult'))
|
call assert_equal([], readfile('Xresult'))
|
||||||
endif
|
endif
|
||||||
call delete('Xresult')
|
call delete('Xresult')
|
||||||
call delete('Xscript')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for errors in defining new functions
|
" Test for errors in defining new functions
|
||||||
@@ -417,9 +414,8 @@ func Test_func_def_error()
|
|||||||
call assert_fails('call feedkeys(":func d.F1()\<CR>", "xt")', 'E717:')
|
call assert_fails('call feedkeys(":func d.F1()\<CR>", "xt")', 'E717:')
|
||||||
|
|
||||||
" Define an autoload function with an incorrect file name
|
" Define an autoload function with an incorrect file name
|
||||||
call writefile(['func foo#Bar()', 'return 1', 'endfunc'], 'Xscript')
|
call writefile(['func foo#Bar()', 'return 1', 'endfunc'], 'Xscript', 'D')
|
||||||
call assert_fails('source Xscript', 'E746:')
|
call assert_fails('source Xscript', 'E746:')
|
||||||
call delete('Xscript')
|
|
||||||
|
|
||||||
" Try to list functions using an invalid search pattern
|
" Try to list functions using an invalid search pattern
|
||||||
call assert_fails('function /\%(/', 'E53:')
|
call assert_fails('function /\%(/', 'E53:')
|
||||||
@@ -444,9 +440,8 @@ endfunc
|
|||||||
|
|
||||||
" Test for calling return outside of a function
|
" Test for calling return outside of a function
|
||||||
func Test_return_outside_func()
|
func Test_return_outside_func()
|
||||||
call writefile(['return 10'], 'Xscript')
|
call writefile(['return 10'], 'Xscript', 'D')
|
||||||
call assert_fails('source Xscript', 'E133:')
|
call assert_fails('source Xscript', 'E133:')
|
||||||
call delete('Xscript')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for errors in calling a function
|
" Test for errors in calling a function
|
||||||
|
@@ -239,7 +239,7 @@ func Test_Ambiguous()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_redefine_on_reload()
|
func Test_redefine_on_reload()
|
||||||
call writefile(['command ExistingCommand echo "yes"'], 'Xcommandexists')
|
call writefile(['command ExistingCommand echo "yes"'], 'Xcommandexists', 'D')
|
||||||
call assert_equal(0, exists(':ExistingCommand'))
|
call assert_equal(0, exists(':ExistingCommand'))
|
||||||
source Xcommandexists
|
source Xcommandexists
|
||||||
call assert_equal(2, exists(':ExistingCommand'))
|
call assert_equal(2, exists(':ExistingCommand'))
|
||||||
@@ -248,9 +248,8 @@ func Test_redefine_on_reload()
|
|||||||
call assert_equal(2, exists(':ExistingCommand'))
|
call assert_equal(2, exists(':ExistingCommand'))
|
||||||
|
|
||||||
" But redefining in another script is not OK.
|
" But redefining in another script is not OK.
|
||||||
call writefile(['command ExistingCommand echo "yes"'], 'Xcommandexists2')
|
call writefile(['command ExistingCommand echo "yes"'], 'Xcommandexists2', 'D')
|
||||||
call assert_fails('source Xcommandexists2', 'E174:')
|
call assert_fails('source Xcommandexists2', 'E174:')
|
||||||
call delete('Xcommandexists2')
|
|
||||||
|
|
||||||
" And defining twice in one script is not OK.
|
" And defining twice in one script is not OK.
|
||||||
delcommand ExistingCommand
|
delcommand ExistingCommand
|
||||||
@@ -262,7 +261,6 @@ func Test_redefine_on_reload()
|
|||||||
call assert_fails('source Xcommandexists', 'E174:')
|
call assert_fails('source Xcommandexists', 'E174:')
|
||||||
call assert_equal(2, exists(':ExistingCommand'))
|
call assert_equal(2, exists(':ExistingCommand'))
|
||||||
|
|
||||||
call delete('Xcommandexists')
|
|
||||||
delcommand ExistingCommand
|
delcommand ExistingCommand
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -849,7 +847,7 @@ func Test_block_declaration_legacy_script()
|
|||||||
@a = save
|
@a = save
|
||||||
}
|
}
|
||||||
END
|
END
|
||||||
call writefile(lines, 'Xlegacy')
|
call writefile(lines, 'Xlegacy', 'D')
|
||||||
source Xlegacy
|
source Xlegacy
|
||||||
|
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
@@ -864,12 +862,10 @@ func Test_block_declaration_legacy_script()
|
|||||||
call assert_equal('something', g:someExpr)
|
call assert_equal('something', g:someExpr)
|
||||||
call assert_equal('also', @a)
|
call assert_equal('also', @a)
|
||||||
END
|
END
|
||||||
call writefile(lines, 'Xother')
|
call writefile(lines, 'Xother', 'D')
|
||||||
source Xother
|
source Xother
|
||||||
|
|
||||||
unlet g:someExpr
|
unlet g:someExpr
|
||||||
call delete('Xlegacy')
|
|
||||||
call delete('Xother')
|
|
||||||
delcommand Rename
|
delcommand Rename
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ func Test_viminfo_read_and_write()
|
|||||||
\ '|copied as-is',
|
\ '|copied as-is',
|
||||||
\ '|and one more',
|
\ '|and one more',
|
||||||
\ ]
|
\ ]
|
||||||
call writefile(lines, 'Xviminfo')
|
call writefile(lines, 'Xviminfo', 'D')
|
||||||
rviminfo Xviminfo
|
rviminfo Xviminfo
|
||||||
call assert_equal('asdf', @/)
|
call assert_equal('asdf', @/)
|
||||||
|
|
||||||
@@ -40,8 +40,6 @@ func Test_viminfo_read_and_write()
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
call assert_equal(3, done)
|
call assert_equal(3, done)
|
||||||
|
|
||||||
call delete('Xviminfo')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_global_vars()
|
func Test_global_vars()
|
||||||
@@ -130,7 +128,7 @@ func Test_global_vars()
|
|||||||
\ "!GLOB_BLOB_3\tBLO\t0z1x",
|
\ "!GLOB_BLOB_3\tBLO\t0z1x",
|
||||||
\ "!GLOB_BLOB_4\tBLO\t0z12 ab",
|
\ "!GLOB_BLOB_4\tBLO\t0z12 ab",
|
||||||
\ "!GLOB_LIST_1\tLIS\t1 2",
|
\ "!GLOB_LIST_1\tLIS\t1 2",
|
||||||
\ "!GLOB_DICT_1\tDIC\t1 2"], 'Xviminfo')
|
\ "!GLOB_DICT_1\tDIC\t1 2"], 'Xviminfo', 'D')
|
||||||
call assert_fails('rv! Xviminfo', 'E488:')
|
call assert_fails('rv! Xviminfo', 'E488:')
|
||||||
call assert_equal('123', g:GLOB_BLOB_1)
|
call assert_equal('123', g:GLOB_BLOB_1)
|
||||||
call assert_equal(1, type(g:GLOB_BLOB_1))
|
call assert_equal(1, type(g:GLOB_BLOB_1))
|
||||||
@@ -145,7 +143,6 @@ func Test_global_vars()
|
|||||||
call assert_equal('1 2', g:GLOB_DICT_1)
|
call assert_equal('1 2', g:GLOB_DICT_1)
|
||||||
call assert_equal(1, type(g:GLOB_DICT_1))
|
call assert_equal(1, type(g:GLOB_DICT_1))
|
||||||
|
|
||||||
call delete('Xviminfo')
|
|
||||||
set viminfo-=!
|
set viminfo-=!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -583,7 +580,7 @@ func Test_viminfo_bad_syntax()
|
|||||||
call add(lines, '|1,"x\') " trailing backslash
|
call add(lines, '|1,"x\') " trailing backslash
|
||||||
call add(lines, '|1,,,,') "trailing comma
|
call add(lines, '|1,,,,') "trailing comma
|
||||||
call add(lines, '|1,>234') " trailing continuation line
|
call add(lines, '|1,>234') " trailing continuation line
|
||||||
call writefile(lines, 'Xviminfo')
|
call writefile(lines, 'Xviminfo', 'D')
|
||||||
rviminfo Xviminfo
|
rviminfo Xviminfo
|
||||||
|
|
||||||
call delete('Xviminfo')
|
call delete('Xviminfo')
|
||||||
@@ -613,9 +610,8 @@ func Test_viminfo_bad_syntax2()
|
|||||||
call add(lines, '|4,20,1,1,1,"x"') " invalid value for file name
|
call add(lines, '|4,20,1,1,1,"x"') " invalid value for file name
|
||||||
call add(lines, '|4,49,0,1,1,"x"') " invalid value for line number
|
call add(lines, '|4,49,0,1,1,"x"') " invalid value for line number
|
||||||
|
|
||||||
call writefile(lines, 'Xviminfo')
|
call writefile(lines, 'Xviminfo', 'D')
|
||||||
rviminfo Xviminfo
|
rviminfo Xviminfo
|
||||||
call delete('Xviminfo')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_viminfo_file_marks()
|
func Test_viminfo_file_marks()
|
||||||
@@ -691,10 +687,9 @@ func Test_viminfo_file_mark_zero_time()
|
|||||||
\ '|4,66,1,0,0,"/tmp/nothing"',
|
\ '|4,66,1,0,0,"/tmp/nothing"',
|
||||||
\ "",
|
\ "",
|
||||||
\ ]
|
\ ]
|
||||||
call writefile(lines, 'Xviminfo')
|
call writefile(lines, 'Xviminfo', 'D')
|
||||||
delmark B
|
delmark B
|
||||||
rviminfo Xviminfo
|
rviminfo Xviminfo
|
||||||
call delete('Xviminfo')
|
|
||||||
call assert_equal(1, line("'B"))
|
call assert_equal(1, line("'B"))
|
||||||
delmark B
|
delmark B
|
||||||
endfunc
|
endfunc
|
||||||
@@ -703,7 +698,7 @@ endfunc
|
|||||||
func Test_viminfo_file_mark_unloaded_buf()
|
func Test_viminfo_file_mark_unloaded_buf()
|
||||||
let save_viminfo = &viminfo
|
let save_viminfo = &viminfo
|
||||||
set viminfo&vim
|
set viminfo&vim
|
||||||
call writefile(repeat(['vim'], 10), 'Xfile1')
|
call writefile(repeat(['vim'], 10), 'Xfile1', 'D')
|
||||||
%bwipe
|
%bwipe
|
||||||
edit! Xfile1
|
edit! Xfile1
|
||||||
call setpos("'u", [0, 3, 1, 0])
|
call setpos("'u", [0, 3, 1, 0])
|
||||||
@@ -716,7 +711,6 @@ func Test_viminfo_file_mark_unloaded_buf()
|
|||||||
call assert_equal([0, 3, 1, 0], getpos("'u"))
|
call assert_equal([0, 3, 1, 0], getpos("'u"))
|
||||||
call assert_equal([0, 5, 1, 0], getpos("'v"))
|
call assert_equal([0, 5, 1, 0], getpos("'v"))
|
||||||
%bwipe
|
%bwipe
|
||||||
call delete('Xfile1')
|
|
||||||
call delete('Xviminfo')
|
call delete('Xviminfo')
|
||||||
let &viminfo = save_viminfo
|
let &viminfo = save_viminfo
|
||||||
endfunc
|
endfunc
|
||||||
@@ -745,11 +739,10 @@ func Test_viminfo_oldfiles()
|
|||||||
\ "\t\"\t11\t0",
|
\ "\t\"\t11\t0",
|
||||||
\ "",
|
\ "",
|
||||||
\ ]
|
\ ]
|
||||||
call writefile(lines, 'Xviminfo')
|
call writefile(lines, 'Xviminfo', 'D')
|
||||||
delmark E
|
delmark E
|
||||||
edit /tmp/file_two.txt
|
edit /tmp/file_two.txt
|
||||||
rviminfo! Xviminfo
|
rviminfo! Xviminfo
|
||||||
call delete('Xviminfo')
|
|
||||||
|
|
||||||
call assert_equal('h viminfo', histget(':'))
|
call assert_equal('h viminfo', histget(':'))
|
||||||
call assert_equal('session', histget('/'))
|
call assert_equal('session', histget('/'))
|
||||||
@@ -839,7 +832,7 @@ func Test_viminfo_error()
|
|||||||
call assert_fails('rviminfo xyz', 'E195:')
|
call assert_fails('rviminfo xyz', 'E195:')
|
||||||
|
|
||||||
" Illegal starting character
|
" Illegal starting character
|
||||||
call writefile(["a 123"], 'Xviminfo')
|
call writefile(["a 123"], 'Xviminfo', 'D')
|
||||||
call assert_fails('rv Xviminfo', 'E575:')
|
call assert_fails('rv Xviminfo', 'E575:')
|
||||||
|
|
||||||
" Illegal register name in the viminfo file
|
" Illegal register name in the viminfo file
|
||||||
@@ -859,8 +852,6 @@ func Test_viminfo_error()
|
|||||||
|
|
||||||
call writefile(repeat(['"@'], 15), 'Xviminfo')
|
call writefile(repeat(['"@'], 15), 'Xviminfo')
|
||||||
call assert_fails('rv Xviminfo', 'E577:')
|
call assert_fails('rv Xviminfo', 'E577:')
|
||||||
|
|
||||||
call delete('Xviminfo')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for saving and restoring last substitute string in viminfo
|
" Test for saving and restoring last substitute string in viminfo
|
||||||
@@ -901,7 +892,7 @@ func Test_viminfo_registers_old()
|
|||||||
\ " :echo 'Hello'\<CR>",
|
\ " :echo 'Hello'\<CR>",
|
||||||
\ "",
|
\ "",
|
||||||
\ ]
|
\ ]
|
||||||
call writefile(lines, 'Xviminfo')
|
call writefile(lines, 'Xviminfo', 'D')
|
||||||
let @a = 'one'
|
let @a = 'one'
|
||||||
let @b = 'two'
|
let @b = 'two'
|
||||||
let @m = 'three'
|
let @m = 'three'
|
||||||
@@ -919,7 +910,7 @@ func Test_viminfo_registers_old()
|
|||||||
call assert_equal(":echo 'Hello'\<CR>", getreg('m'))
|
call assert_equal(":echo 'Hello'\<CR>", getreg('m'))
|
||||||
call assert_equal('Vim', getreg('"'))
|
call assert_equal('Vim', getreg('"'))
|
||||||
call assert_equal("\nHello", execute('normal @@'))
|
call assert_equal("\nHello", execute('normal @@'))
|
||||||
call delete('Xviminfo')
|
|
||||||
let @" = ''
|
let @" = ''
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -931,11 +922,11 @@ func Test_viminfo_large_register()
|
|||||||
set viminfo+=<200
|
set viminfo+=<200
|
||||||
let lines = ['"r CHAR 0']
|
let lines = ['"r CHAR 0']
|
||||||
call extend(lines, repeat(["\tsun is rising"], 200))
|
call extend(lines, repeat(["\tsun is rising"], 200))
|
||||||
call writefile(lines, 'Xviminfo')
|
call writefile(lines, 'Xviminfo', 'D')
|
||||||
let @r = ''
|
let @r = ''
|
||||||
rviminfo! Xviminfo
|
rviminfo! Xviminfo
|
||||||
call assert_equal(join(repeat(["sun is rising"], 200), "\n"), @r)
|
call assert_equal(join(repeat(["sun is rising"], 200), "\n"), @r)
|
||||||
call delete('Xviminfo')
|
|
||||||
let @r = ''
|
let @r = ''
|
||||||
let &viminfo = save_viminfo
|
let &viminfo = save_viminfo
|
||||||
endfunc
|
endfunc
|
||||||
@@ -946,9 +937,9 @@ func Test_viminfofile_none()
|
|||||||
set viminfofile=NONE
|
set viminfofile=NONE
|
||||||
wviminfo Xviminfo
|
wviminfo Xviminfo
|
||||||
call assert_false(filereadable('Xviminfo'))
|
call assert_false(filereadable('Xviminfo'))
|
||||||
call writefile([''], 'Xviminfo')
|
call writefile([''], 'Xviminfo', 'D')
|
||||||
call assert_fails('rviminfo Xviminfo', 'E195:')
|
call assert_fails('rviminfo Xviminfo', 'E195:')
|
||||||
call delete('Xviminfo')
|
|
||||||
let &viminfofile = save_vif
|
let &viminfofile = save_vif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -956,18 +947,16 @@ endfunc
|
|||||||
func Test_viminfo_perm()
|
func Test_viminfo_perm()
|
||||||
CheckUnix
|
CheckUnix
|
||||||
CheckNotRoot
|
CheckNotRoot
|
||||||
call writefile([''], 'Xviminfo')
|
call writefile([''], 'Xviminfo', 'D')
|
||||||
call setfperm('Xviminfo', 'r-x------')
|
call setfperm('Xviminfo', 'r-x------')
|
||||||
call assert_fails('wviminfo Xviminfo', 'E137:')
|
call assert_fails('wviminfo Xviminfo', 'E137:')
|
||||||
call setfperm('Xviminfo', '--x------')
|
call setfperm('Xviminfo', '--x------')
|
||||||
call assert_fails('rviminfo Xviminfo', 'E195:')
|
call assert_fails('rviminfo Xviminfo', 'E195:')
|
||||||
call delete('Xviminfo')
|
|
||||||
|
|
||||||
" Try to write the viminfo to a directory
|
" Try to write the viminfo to a directory
|
||||||
call mkdir('Xvifdir')
|
call mkdir('Xvifdir', 'R')
|
||||||
call assert_fails('wviminfo Xvifdir', 'E137:')
|
call assert_fails('wviminfo Xvifdir', 'E137:')
|
||||||
call assert_fails('rviminfo Xvifdir', 'E195:')
|
call assert_fails('rviminfo Xvifdir', 'E195:')
|
||||||
call delete('Xvifdir', 'rf')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for writing to an existing viminfo file merges the file marks
|
" Test for writing to an existing viminfo file merges the file marks
|
||||||
@@ -979,8 +968,8 @@ func XTest_viminfo_marks_merge()
|
|||||||
%argdelete
|
%argdelete
|
||||||
%bwipe
|
%bwipe
|
||||||
|
|
||||||
call writefile(repeat(['editor'], 10), 'Xbufa')
|
call writefile(repeat(['editor'], 10), 'Xbufa', 'D')
|
||||||
call writefile(repeat(['Vim'], 10), 'Xbufb')
|
call writefile(repeat(['Vim'], 10), 'Xbufb', 'D')
|
||||||
|
|
||||||
" set marks in buffers
|
" set marks in buffers
|
||||||
call test_settime(10)
|
call test_settime(10)
|
||||||
@@ -1013,8 +1002,6 @@ func XTest_viminfo_marks_merge()
|
|||||||
" cleanup
|
" cleanup
|
||||||
%bwipe
|
%bwipe
|
||||||
call delete('Xviminfo')
|
call delete('Xviminfo')
|
||||||
call delete('Xbufa')
|
|
||||||
call delete('Xbufb')
|
|
||||||
call test_settime(0)
|
call test_settime(0)
|
||||||
let &viminfo=save_viminfo
|
let &viminfo=save_viminfo
|
||||||
endfunc
|
endfunc
|
||||||
@@ -1051,7 +1038,7 @@ func Test_viminfo_oldfiles_newfile()
|
|||||||
w! Xnew-file.txt
|
w! Xnew-file.txt
|
||||||
qall
|
qall
|
||||||
[CODE]
|
[CODE]
|
||||||
call writefile(commands, 'Xviminfotest')
|
call writefile(commands, 'Xviminfotest', 'D')
|
||||||
let buf = RunVimInTerminal('-S Xviminfotest', #{wait_for_ruler: 0})
|
let buf = RunVimInTerminal('-S Xviminfotest', #{wait_for_ruler: 0})
|
||||||
call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))})
|
call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))})
|
||||||
|
|
||||||
@@ -1059,8 +1046,8 @@ func Test_viminfo_oldfiles_newfile()
|
|||||||
rviminfo! Xviminfofile
|
rviminfo! Xviminfofile
|
||||||
call assert_match('Xnew-file.txt$', v:oldfiles[0])
|
call assert_match('Xnew-file.txt$', v:oldfiles[0])
|
||||||
call assert_equal(1, len(v:oldfiles))
|
call assert_equal(1, len(v:oldfiles))
|
||||||
|
|
||||||
call delete('Xviminfofile')
|
call delete('Xviminfofile')
|
||||||
call delete('Xviminfotest')
|
|
||||||
call delete('Xnew-file.txt')
|
call delete('Xnew-file.txt')
|
||||||
|
|
||||||
let v:oldfiles = test_null_list()
|
let v:oldfiles = test_null_list()
|
||||||
@@ -1262,7 +1249,7 @@ func Test_viminfo_merge_old_filemarks()
|
|||||||
call add(lines, '|1,4')
|
call add(lines, '|1,4')
|
||||||
call add(lines, '> ' .. fnamemodify('a.txt', ':p:~'))
|
call add(lines, '> ' .. fnamemodify('a.txt', ':p:~'))
|
||||||
call add(lines, "\tb\t7\t0\n")
|
call add(lines, "\tb\t7\t0\n")
|
||||||
call writefile(lines, 'Xviminfo')
|
call writefile(lines, 'Xviminfo', 'D')
|
||||||
edit b.txt
|
edit b.txt
|
||||||
call setline(1, range(1, 20))
|
call setline(1, range(1, 20))
|
||||||
12mark b
|
12mark b
|
||||||
@@ -1274,7 +1261,6 @@ func Test_viminfo_merge_old_filemarks()
|
|||||||
edit b.txt
|
edit b.txt
|
||||||
rviminfo! Xviminfo
|
rviminfo! Xviminfo
|
||||||
call assert_equal(12, line("'b"))
|
call assert_equal(12, line("'b"))
|
||||||
call delete('Xviminfo')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for merging the jump list from a old viminfo file
|
" Test for merging the jump list from a old viminfo file
|
||||||
@@ -1284,14 +1270,13 @@ func Test_viminfo_merge_old_jumplist()
|
|||||||
call add(lines, "-' 20 1 " .. fnamemodify('a.txt', ':p:~'))
|
call add(lines, "-' 20 1 " .. fnamemodify('a.txt', ':p:~'))
|
||||||
call add(lines, "-' 30 1 " .. fnamemodify('b.txt', ':p:~'))
|
call add(lines, "-' 30 1 " .. fnamemodify('b.txt', ':p:~'))
|
||||||
call add(lines, "-' 40 1 " .. fnamemodify('b.txt', ':p:~'))
|
call add(lines, "-' 40 1 " .. fnamemodify('b.txt', ':p:~'))
|
||||||
call writefile(lines, 'Xviminfo')
|
call writefile(lines, 'Xviminfo', 'D')
|
||||||
clearjumps
|
clearjumps
|
||||||
rviminfo! Xviminfo
|
rviminfo! Xviminfo
|
||||||
let l = getjumplist()[0]
|
let l = getjumplist()[0]
|
||||||
call assert_equal([40, 30, 20, 10], [l[0].lnum, l[1].lnum, l[2].lnum,
|
call assert_equal([40, 30, 20, 10], [l[0].lnum, l[1].lnum, l[2].lnum,
|
||||||
\ l[3].lnum])
|
\ l[3].lnum])
|
||||||
bw!
|
bw!
|
||||||
call delete('Xviminfo')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -33,15 +33,13 @@ func RunInNewVim(test, verify)
|
|||||||
call writefile(v:errors, 'Xtest.out')
|
call writefile(v:errors, 'Xtest.out')
|
||||||
qall
|
qall
|
||||||
END
|
END
|
||||||
call writefile(init, 'Xtest.vim')
|
call writefile(init, 'Xtest.vim', 'D')
|
||||||
call writefile(a:test, 'Xtest.vim', 'a')
|
call writefile(a:test, 'Xtest.vim', 'a')
|
||||||
call writefile(a:verify, 'Xverify.vim')
|
call writefile(a:verify, 'Xverify.vim', 'D')
|
||||||
call writefile(cleanup, 'Xverify.vim', 'a')
|
call writefile(cleanup, 'Xverify.vim', 'a')
|
||||||
call RunVim([], [], "-S Xtest.vim -S Xverify.vim")
|
call RunVim([], [], "-S Xtest.vim -S Xverify.vim")
|
||||||
call assert_equal([], readfile('Xtest.out'))
|
call assert_equal([], readfile('Xtest.out'))
|
||||||
call delete('Xtest.out')
|
call delete('Xtest.out')
|
||||||
call delete('Xtest.vim')
|
|
||||||
call delete('Xverify.vim')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
@@ -2935,7 +2933,7 @@ func Test_nested_if_else_errors()
|
|||||||
let code =<< trim END
|
let code =<< trim END
|
||||||
endif
|
endif
|
||||||
END
|
END
|
||||||
call writefile(code, 'Xtest')
|
call writefile(code, 'Xtest', 'D')
|
||||||
call AssertException(['source Xtest'], 'Vim(endif):E580: :endif without :if')
|
call AssertException(['source Xtest'], 'Vim(endif):E580: :endif without :if')
|
||||||
|
|
||||||
" :endif without :if
|
" :endif without :if
|
||||||
@@ -3088,8 +3086,6 @@ func Test_nested_if_else_errors()
|
|||||||
END
|
END
|
||||||
call writefile(code, 'Xtest')
|
call writefile(code, 'Xtest')
|
||||||
call AssertException(['source Xtest'], 'Vim(elseif):E584: :elseif after :else')
|
call AssertException(['source Xtest'], 'Vim(elseif):E584: :elseif after :else')
|
||||||
|
|
||||||
call delete('Xtest')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
@@ -3118,7 +3114,7 @@ func Test_nested_while_error()
|
|||||||
endwhile
|
endwhile
|
||||||
endif
|
endif
|
||||||
END
|
END
|
||||||
call writefile(code, 'Xtest')
|
call writefile(code, 'Xtest', 'D')
|
||||||
call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while')
|
call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while')
|
||||||
|
|
||||||
" Missing :endif
|
" Missing :endif
|
||||||
@@ -3215,8 +3211,6 @@ func Test_nested_while_error()
|
|||||||
END
|
END
|
||||||
call writefile(code, 'Xtest')
|
call writefile(code, 'Xtest')
|
||||||
call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while')
|
call AssertException(['source Xtest'], 'Vim(endwhile):E588: :endwhile without :while')
|
||||||
|
|
||||||
call delete('Xtest')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
@@ -3236,7 +3230,7 @@ func Test_nested_cont_break_error()
|
|||||||
let code =<< trim END
|
let code =<< trim END
|
||||||
continue
|
continue
|
||||||
END
|
END
|
||||||
call writefile(code, 'Xtest')
|
call writefile(code, 'Xtest', 'D')
|
||||||
call AssertException(['source Xtest'], 'Vim(continue):E586: :continue without :while or :for')
|
call AssertException(['source Xtest'], 'Vim(continue):E586: :continue without :while or :for')
|
||||||
|
|
||||||
" :continue without :while
|
" :continue without :while
|
||||||
@@ -3323,8 +3317,6 @@ func Test_nested_cont_break_error()
|
|||||||
END
|
END
|
||||||
call writefile(code, 'Xtest')
|
call writefile(code, 'Xtest')
|
||||||
call AssertException(['source Xtest'], 'Vim(break):E587: :break without :while or :for')
|
call AssertException(['source Xtest'], 'Vim(break):E587: :break without :while or :for')
|
||||||
|
|
||||||
call delete('Xtest')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
@@ -3344,7 +3336,7 @@ func Test_nested_endtry_error()
|
|||||||
let code =<< trim END
|
let code =<< trim END
|
||||||
endtry
|
endtry
|
||||||
END
|
END
|
||||||
call writefile(code, 'Xtest')
|
call writefile(code, 'Xtest', 'D')
|
||||||
call AssertException(['source Xtest'], 'Vim(endtry):E602: :endtry without :try')
|
call AssertException(['source Xtest'], 'Vim(endtry):E602: :endtry without :try')
|
||||||
|
|
||||||
" :endtry without :try
|
" :endtry without :try
|
||||||
@@ -3424,8 +3416,6 @@ func Test_nested_endtry_error()
|
|||||||
END
|
END
|
||||||
call writefile(code, 'Xtest')
|
call writefile(code, 'Xtest')
|
||||||
call AssertException(['source Xtest'], 'Vim(endtry):E170: Missing :endwhile')
|
call AssertException(['source Xtest'], 'Vim(endtry):E170: Missing :endwhile')
|
||||||
|
|
||||||
call delete('Xtest')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
@@ -5891,7 +5881,7 @@ func Test_discard_exception_after_error_2()
|
|||||||
endtry
|
endtry
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
[CODE]
|
[CODE]
|
||||||
call writefile(lines, 'Xscript')
|
call writefile(lines, 'Xscript', 'D')
|
||||||
|
|
||||||
breakadd file 7 Xscript
|
breakadd file 7 Xscript
|
||||||
try
|
try
|
||||||
@@ -5906,7 +5896,6 @@ func Test_discard_exception_after_error_2()
|
|||||||
call assert_equal(1, caught_intr)
|
call assert_equal(1, caught_intr)
|
||||||
call assert_equal('ab', g:Xpath)
|
call assert_equal('ab', g:Xpath)
|
||||||
breakdel *
|
breakdel *
|
||||||
call delete('Xscript')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
@@ -5996,7 +5985,7 @@ func Test_ignore_catch_after_intr_1()
|
|||||||
endtry
|
endtry
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
[CODE]
|
[CODE]
|
||||||
call writefile(lines, 'Xscript')
|
call writefile(lines, 'Xscript', 'D')
|
||||||
|
|
||||||
breakadd file 6 Xscript
|
breakadd file 6 Xscript
|
||||||
try
|
try
|
||||||
@@ -6011,7 +6000,6 @@ func Test_ignore_catch_after_intr_1()
|
|||||||
call assert_equal(1, caught_intr)
|
call assert_equal(1, caught_intr)
|
||||||
call assert_equal('a', g:Xpath)
|
call assert_equal('a', g:Xpath)
|
||||||
breakdel *
|
breakdel *
|
||||||
call delete('Xscript')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" interrupt right before a catch is invoked inside a function.
|
" interrupt right before a catch is invoked inside a function.
|
||||||
@@ -6104,7 +6092,7 @@ func Test_finally_after_intr()
|
|||||||
endtry
|
endtry
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
[CODE]
|
[CODE]
|
||||||
call writefile(lines, 'Xscript')
|
call writefile(lines, 'Xscript', 'D')
|
||||||
|
|
||||||
breakadd file 7 Xscript
|
breakadd file 7 Xscript
|
||||||
try
|
try
|
||||||
@@ -6119,7 +6107,6 @@ func Test_finally_after_intr()
|
|||||||
call assert_equal(1, caught_intr)
|
call assert_equal(1, caught_intr)
|
||||||
call assert_equal('abc', g:Xpath)
|
call assert_equal('abc', g:Xpath)
|
||||||
breakdel *
|
breakdel *
|
||||||
call delete('Xscript')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
@@ -6963,13 +6950,12 @@ func Test_script_expand_sfile()
|
|||||||
endfunc
|
endfunc
|
||||||
let g:result = s:snr()
|
let g:result = s:snr()
|
||||||
END
|
END
|
||||||
call writefile(lines, 'Xexpand')
|
call writefile(lines, 'Xexpand', 'D')
|
||||||
source Xexpand
|
source Xexpand
|
||||||
call assert_match('<SNR>\d\+_snr', g:result)
|
call assert_match('<SNR>\d\+_snr', g:result)
|
||||||
source Xexpand
|
source Xexpand
|
||||||
call assert_match('<SNR>\d\+_snr', g:result)
|
call assert_match('<SNR>\d\+_snr', g:result)
|
||||||
|
|
||||||
call delete('Xexpand')
|
|
||||||
unlet g:result
|
unlet g:result
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
@@ -7230,7 +7216,7 @@ endfunc
|
|||||||
|
|
||||||
" Test for missing :endif, :endfor, :endwhile and :endtry {{{1
|
" Test for missing :endif, :endfor, :endwhile and :endtry {{{1
|
||||||
func Test_missing_end()
|
func Test_missing_end()
|
||||||
call writefile(['if 2 > 1', 'echo ">"'], 'Xscript')
|
call writefile(['if 2 > 1', 'echo ">"'], 'Xscript', 'D')
|
||||||
call assert_fails('source Xscript', 'E171:')
|
call assert_fails('source Xscript', 'E171:')
|
||||||
call writefile(['for i in range(5)', 'echo i'], 'Xscript')
|
call writefile(['for i in range(5)', 'echo i'], 'Xscript')
|
||||||
call assert_fails('source Xscript', 'E170:')
|
call assert_fails('source Xscript', 'E170:')
|
||||||
@@ -7238,7 +7224,6 @@ func Test_missing_end()
|
|||||||
call assert_fails('source Xscript', 'E170:')
|
call assert_fails('source Xscript', 'E170:')
|
||||||
call writefile(['try', 'echo "."'], 'Xscript')
|
call writefile(['try', 'echo "."'], 'Xscript')
|
||||||
call assert_fails('source Xscript', 'E600:')
|
call assert_fails('source Xscript', 'E600:')
|
||||||
call delete('Xscript')
|
|
||||||
|
|
||||||
" Using endfor with :while
|
" Using endfor with :while
|
||||||
let caught_e732 = 0
|
let caught_e732 = 0
|
||||||
@@ -7320,7 +7305,7 @@ func Test_deep_nest()
|
|||||||
let @a = ''
|
let @a = ''
|
||||||
endfunc
|
endfunc
|
||||||
[SCRIPT]
|
[SCRIPT]
|
||||||
call writefile(lines, 'Xscript')
|
call writefile(lines, 'Xscript', 'D')
|
||||||
|
|
||||||
let buf = RunVimInTerminal('-S Xscript', {'rows': 6})
|
let buf = RunVimInTerminal('-S Xscript', {'rows': 6})
|
||||||
|
|
||||||
@@ -7358,7 +7343,6 @@ func Test_deep_nest()
|
|||||||
"call assert_report(l)
|
"call assert_report(l)
|
||||||
|
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('Xscript')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for errors in converting to float from various types {{{1
|
" Test for errors in converting to float from various types {{{1
|
||||||
@@ -7429,9 +7413,8 @@ func Test_invalid_function_names()
|
|||||||
call assert_equal(1, exists('Bar'))
|
call assert_equal(1, exists('Bar'))
|
||||||
call assert_equal(1, exists('*Bar'))
|
call assert_equal(1, exists('*Bar'))
|
||||||
END
|
END
|
||||||
call writefile(lines, 'Xscript')
|
call writefile(lines, 'Xscript', 'D')
|
||||||
source Xscript
|
source Xscript
|
||||||
call delete('Xscript')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" substring and variable name {{{1
|
" substring and variable name {{{1
|
||||||
@@ -7522,13 +7505,11 @@ func Test_deeply_nested_source()
|
|||||||
so
|
so
|
||||||
0
|
0
|
||||||
END
|
END
|
||||||
call writefile(["vim9 silent! @0 \n/"] + lines, 'Xnested.vim')
|
call writefile(["vim9 silent! @0 \n/"] + lines, 'Xnested.vim', 'D')
|
||||||
|
|
||||||
" this must not crash
|
" this must not crash
|
||||||
let cmd = GetVimCommand() .. " -e -s -S Xnested.vim -c qa!"
|
let cmd = GetVimCommand() .. " -e -s -S Xnested.vim -c qa!"
|
||||||
call system(cmd)
|
call system(cmd)
|
||||||
|
|
||||||
call delete('Xnested.vim')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
|
@@ -1274,7 +1274,7 @@ func Test_visual_block_with_virtualedit()
|
|||||||
set virtualedit=block
|
set virtualedit=block
|
||||||
normal G
|
normal G
|
||||||
END
|
END
|
||||||
call writefile(lines, 'XTest_block')
|
call writefile(lines, 'XTest_block', 'D')
|
||||||
|
|
||||||
let buf = RunVimInTerminal('-S XTest_block', {'rows': 8, 'cols': 50})
|
let buf = RunVimInTerminal('-S XTest_block', {'rows': 8, 'cols': 50})
|
||||||
call term_sendkeys(buf, "\<C-V>gg$")
|
call term_sendkeys(buf, "\<C-V>gg$")
|
||||||
@@ -1286,7 +1286,6 @@ func Test_visual_block_with_virtualedit()
|
|||||||
" clean up
|
" clean up
|
||||||
call term_sendkeys(buf, "\<Esc>")
|
call term_sendkeys(buf, "\<Esc>")
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('XTest_block')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_visual_block_ctrl_w_f()
|
func Test_visual_block_ctrl_w_f()
|
||||||
@@ -1331,11 +1330,10 @@ func Test_visual_reselect_with_count()
|
|||||||
|
|
||||||
:
|
:
|
||||||
END
|
END
|
||||||
call writefile(lines, 'XvisualReselect')
|
call writefile(lines, 'XvisualReselect', 'D')
|
||||||
source XvisualReselect
|
source XvisualReselect
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
call delete('XvisualReselect')
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_visual_block_insert_round_off()
|
func Test_visual_block_insert_round_off()
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
768,
|
||||||
/**/
|
/**/
|
||||||
767,
|
767,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user