0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.0.0626: too many delete() calls in tests

Problem:    Too many delete() calls in tests.
Solution:   Use deferred delete where possible.
This commit is contained in:
Bram Moolenaar 2022-09-29 21:37:33 +01:00
parent 7dd5a78b88
commit b152b6a40f
11 changed files with 52 additions and 96 deletions

View File

@ -420,7 +420,7 @@ func Test_error_in_map_expr()
nmap <expr> ! Func() nmap <expr> ! Func()
set updatetime=50 set updatetime=50
[CODE] [CODE]
call writefile(lines, 'Xtest.vim') call writefile(lines, 'Xtest.vim', 'D')
let buf = term_start(GetVimCommandCleanTerm() .. ' -S Xtest.vim', {'term_rows': 8}) let buf = term_start(GetVimCommandCleanTerm() .. ' -S Xtest.vim', {'term_rows': 8})
let job = term_getjob(buf) let job = term_getjob(buf)
@ -439,7 +439,6 @@ func Test_error_in_map_expr()
call assert_equal('', job_info(job).termsig) call assert_equal('', job_info(job).termsig)
endif endif
call delete('Xtest.vim')
exe buf .. 'bwipe!' exe buf .. 'bwipe!'
endfunc endfunc
@ -565,14 +564,13 @@ func Test_expr_map_restore_cursor()
endfunc endfunc
set stl=%{Status()} set stl=%{Status()}
END END
call writefile(lines, 'XtestExprMap') call writefile(lines, 'XtestExprMap', 'D')
let buf = RunVimInTerminal('-S XtestExprMap', #{rows: 10}) let buf = RunVimInTerminal('-S XtestExprMap', #{rows: 10})
call term_sendkeys(buf, "\<C-B>") call term_sendkeys(buf, "\<C-B>")
call VerifyScreenDump(buf, 'Test_map_expr_1', {}) call VerifyScreenDump(buf, 'Test_map_expr_1', {})
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XtestExprMap')
endfunc endfunc
func Test_map_listing() func Test_map_listing()
@ -581,14 +579,13 @@ func Test_map_listing()
let lines =<< trim END let lines =<< trim END
nmap a b nmap a b
END END
call writefile(lines, 'XtestMapList') call writefile(lines, 'XtestMapList', 'D')
let buf = RunVimInTerminal('-S XtestMapList', #{rows: 6}) let buf = RunVimInTerminal('-S XtestMapList', #{rows: 6})
call term_sendkeys(buf, ": nmap a\<CR>") call term_sendkeys(buf, ": nmap a\<CR>")
call VerifyScreenDump(buf, 'Test_map_list_1', {}) call VerifyScreenDump(buf, 'Test_map_list_1', {})
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XtestMapList')
endfunc endfunc
func Test_expr_map_error() func Test_expr_map_error()
@ -605,7 +602,7 @@ func Test_expr_map_error()
call test_override('ui_delay', 10) call test_override('ui_delay', 10)
END END
call writefile(lines, 'XtestExprMap') call writefile(lines, 'XtestExprMap', 'D')
let buf = RunVimInTerminal('-S XtestExprMap', #{rows: 10}) let buf = RunVimInTerminal('-S XtestExprMap', #{rows: 10})
call term_sendkeys(buf, "\<F2>") call term_sendkeys(buf, "\<F2>")
call TermWait(buf) call TermWait(buf)
@ -619,7 +616,6 @@ func Test_expr_map_error()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XtestExprMap')
endfunc endfunc
" Test for mapping errors " Test for mapping errors
@ -1081,11 +1077,10 @@ func Test_map_cmdkey()
let g:x = 32 let g:x = 32
endfunc endfunc
END END
call writefile(lines, 'Xscript') call writefile(lines, 'Xscript', 'D')
source Xscript source Xscript
call feedkeys("\<F2>", 'xt') call feedkeys("\<F2>", 'xt')
call assert_equal(32, g:x) call assert_equal(32, g:x)
call delete('Xscript')
unmap <F3> unmap <F3>
unmap! <F3> unmap! <F3>
@ -1530,7 +1525,7 @@ func Test_map_script_cmd_survives_unmap()
endfunc endfunc
func Test_map_script_cmd_redo() func Test_map_script_cmd_redo()
call mkdir('Xmapcmd') call mkdir('Xmapcmd', 'R')
let lines =<< trim END let lines =<< trim END
vim9script vim9script
import autoload './script.vim' import autoload './script.vim'
@ -1554,7 +1549,6 @@ func Test_map_script_cmd_redo()
ounmap <F3> ounmap <F3>
nunmap j nunmap j
call delete('Xmapcmd', 'rf')
bwipe! bwipe!
endfunc endfunc
@ -1724,7 +1718,7 @@ func Test_map_after_timed_out_nop()
inoremap ab TEST inoremap ab TEST
inoremap a <Nop> inoremap a <Nop>
END END
call writefile(lines, 'Xtest_map_after_timed_out_nop') call writefile(lines, 'Xtest_map_after_timed_out_nop', 'D')
let buf = RunVimInTerminal('-S Xtest_map_after_timed_out_nop', #{rows: 6}) let buf = RunVimInTerminal('-S Xtest_map_after_timed_out_nop', #{rows: 6})
" Enter Insert mode " Enter Insert mode
@ -1741,7 +1735,6 @@ func Test_map_after_timed_out_nop()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xtest_map_after_timed_out_nop')
endfunc endfunc
func Test_using_past_typeahead() func Test_using_past_typeahead()

View File

@ -372,12 +372,11 @@ func Test_match_in_linebreak()
call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1) call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
call matchaddpos('ErrorMsg', [[1, 51]]) call matchaddpos('ErrorMsg', [[1, 51]])
END END
call writefile(lines, 'XscriptMatchLinebreak') call writefile(lines, 'XscriptMatchLinebreak', 'D')
let buf = RunVimInTerminal('-S XscriptMatchLinebreak', #{rows: 10}) let buf = RunVimInTerminal('-S XscriptMatchLinebreak', #{rows: 10})
call VerifyScreenDump(buf, 'Test_match_linebreak', {}) call VerifyScreenDump(buf, 'Test_match_linebreak', {})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XscriptMatchLinebreak')
endfunc endfunc
func Test_match_with_incsearch() func Test_match_with_incsearch()
@ -388,7 +387,7 @@ func Test_match_with_incsearch()
call setline(1, range(20)) call setline(1, range(20))
call matchaddpos('ErrorMsg', [3]) call matchaddpos('ErrorMsg', [3])
END END
call writefile(lines, 'XmatchWithIncsearch') call writefile(lines, 'XmatchWithIncsearch', 'D')
let buf = RunVimInTerminal('-S XmatchWithIncsearch', #{rows: 6}) let buf = RunVimInTerminal('-S XmatchWithIncsearch', #{rows: 6})
call VerifyScreenDump(buf, 'Test_match_with_incsearch_1', {}) call VerifyScreenDump(buf, 'Test_match_with_incsearch_1', {})
@ -397,7 +396,6 @@ func Test_match_with_incsearch()
call term_sendkeys(buf, "\<CR>") call term_sendkeys(buf, "\<CR>")
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XmatchWithIncsearch')
endfunc endfunc
" Test for deleting matches outside of the screen redraw top/bottom lines " Test for deleting matches outside of the screen redraw top/bottom lines
@ -428,12 +426,11 @@ func Test_match_tab_with_linebreak()
call setline(1, "\tix") call setline(1, "\tix")
call matchadd('ErrorMsg', '\t') call matchadd('ErrorMsg', '\t')
END END
call writefile(lines, 'XscriptMatchTabLinebreak') call writefile(lines, 'XscriptMatchTabLinebreak', 'D')
let buf = RunVimInTerminal('-S XscriptMatchTabLinebreak', #{rows: 10}) let buf = RunVimInTerminal('-S XscriptMatchTabLinebreak', #{rows: 10})
call VerifyScreenDump(buf, 'Test_match_tab_linebreak', {}) call VerifyScreenDump(buf, 'Test_match_tab_linebreak', {})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XscriptMatchTabLinebreak')
endfunc endfunc

View File

@ -374,7 +374,7 @@ func Test_cursor_column_in_concealed_line_after_window_scroll()
normal gg normal gg
"==expr== "==expr==
END END
call writefile(lines, 'Xcolesearch') call writefile(lines, 'Xcolesearch', 'D')
let buf = RunVimInTerminal('Xcolesearch', {}) let buf = RunVimInTerminal('Xcolesearch', {})
call TermWait(buf, 50) call TermWait(buf, 50)
@ -394,7 +394,6 @@ func Test_cursor_column_in_concealed_line_after_window_scroll()
call assert_equal(2, term_getcursor(buf)[1]) call assert_equal(2, term_getcursor(buf)[1])
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xcolesearch')
endfunc endfunc
func Test_cursor_column_in_concealed_line_after_leftcol_change() func Test_cursor_column_in_concealed_line_after_leftcol_change()
@ -406,7 +405,7 @@ func Test_cursor_column_in_concealed_line_after_leftcol_change()
call matchadd('Conceal', '-') call matchadd('Conceal', '-')
set nowrap ss=0 cole=3 cocu=n set nowrap ss=0 cole=3 cocu=n
END END
call writefile(lines, 'Xcurs-columns') call writefile(lines, 'Xcurs-columns', 'D')
let buf = RunVimInTerminal('-S Xcurs-columns', {}) let buf = RunVimInTerminal('-S Xcurs-columns', {})
" Go to the end of the line (3 columns beyond the end of the screen). " Go to the end of the line (3 columns beyond the end of the screen).
@ -422,7 +421,6 @@ func Test_cursor_column_in_concealed_line_after_leftcol_change()
call assert_equal(1, term_getcursor(buf)[1]) call assert_equal(1, term_getcursor(buf)[1])
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xcurs-columns')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@ -92,7 +92,7 @@ func Test_memory_func_capture_vargs()
call s:f(0) call s:f(0)
endfor endfor
END END
call writefile(lines, testfile) call writefile(lines, testfile, 'D')
let vim = s:vim_new() let vim = s:vim_new()
call vim.start('--clean', '-c', 'set noswapfile', testfile) call vim.start('--clean', '-c', 'set noswapfile', testfile)
@ -114,7 +114,6 @@ func Test_memory_func_capture_vargs()
call assert_inrange(lower, upper, after.max) call assert_inrange(lower, upper, after.max)
call vim.stop() call vim.stop()
call delete(testfile)
endfunc endfunc
func Test_memory_func_capture_lvars() func Test_memory_func_capture_lvars()
@ -130,7 +129,7 @@ func Test_memory_func_capture_lvars()
call s:f() call s:f()
endfor endfor
END END
call writefile(lines, testfile) call writefile(lines, testfile, 'D')
let vim = s:vim_new() let vim = s:vim_new()
call vim.start('--clean', '-c', 'set noswapfile', testfile) call vim.start('--clean', '-c', 'set noswapfile', testfile)
@ -161,7 +160,6 @@ func Test_memory_func_capture_lvars()
call assert_inrange(lower, upper, last) call assert_inrange(lower, upper, last)
call vim.stop() call vim.stop()
call delete(testfile)
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@ -103,7 +103,7 @@ func Test_mode_message_at_leaving_insert_by_ctrl_c()
set statusline=%!StatusLine() set statusline=%!StatusLine()
set laststatus=2 set laststatus=2
END END
call writefile(lines, testfile) call writefile(lines, testfile, 'D')
let rows = 10 let rows = 10
let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows}) let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
@ -117,8 +117,8 @@ func Test_mode_message_at_leaving_insert_by_ctrl_c()
call term_sendkeys(buf, ":qall!\<CR>") call term_sendkeys(buf, ":qall!\<CR>")
call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))}) call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
exe buf . 'bwipe!' exe buf . 'bwipe!'
call delete(testfile)
endfunc endfunc
func Test_mode_message_at_leaving_insert_with_esc_mapped() func Test_mode_message_at_leaving_insert_with_esc_mapped()
@ -131,7 +131,7 @@ func Test_mode_message_at_leaving_insert_with_esc_mapped()
set laststatus=2 set laststatus=2
inoremap <Esc> <Esc>00 inoremap <Esc> <Esc>00
END END
call writefile(lines, testfile) call writefile(lines, testfile, 'D')
let rows = 10 let rows = 10
let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows}) let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
@ -145,8 +145,8 @@ func Test_mode_message_at_leaving_insert_with_esc_mapped()
call term_sendkeys(buf, ":qall!\<CR>") call term_sendkeys(buf, ":qall!\<CR>")
call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))}) call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
exe buf . 'bwipe!' exe buf . 'bwipe!'
call delete(testfile)
endfunc endfunc
func Test_echospace() func Test_echospace()
@ -462,7 +462,7 @@ func Test_fileinfo_after_echo()
autocmd CursorHold * buf b.txt | w | echo "'b' written" autocmd CursorHold * buf b.txt | w | echo "'b' written"
END END
call writefile(content, 'Xtest_fileinfo_after_echo') call writefile(content, 'Xtest_fileinfo_after_echo', 'D')
let buf = RunVimInTerminal('-S Xtest_fileinfo_after_echo', #{rows: 6}) let buf = RunVimInTerminal('-S Xtest_fileinfo_after_echo', #{rows: 6})
call term_sendkeys(buf, ":set updatetime=50\<CR>") call term_sendkeys(buf, ":set updatetime=50\<CR>")
call term_sendkeys(buf, "0$") call term_sendkeys(buf, "0$")
@ -472,7 +472,6 @@ func Test_fileinfo_after_echo()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xtest_fileinfo_after_echo')
call delete('b.txt') call delete('b.txt')
endfunc endfunc
@ -513,7 +512,7 @@ func Test_echowindow()
echo 'three' echo 'three'
enddef enddef
END END
call writefile(lines, 'XtestEchowindow') call writefile(lines, 'XtestEchowindow', 'D')
let buf = RunVimInTerminal('-S XtestEchowindow', #{rows: 8}) let buf = RunVimInTerminal('-S XtestEchowindow', #{rows: 8})
call VerifyScreenDump(buf, 'Test_echowindow_1', {}) call VerifyScreenDump(buf, 'Test_echowindow_1', {})
@ -542,7 +541,6 @@ func Test_echowindow()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XtestEchowindow')
endfunc endfunc
" messages window should not be used while evaluating the :echowin argument " messages window should not be used while evaluating the :echowin argument
@ -556,13 +554,12 @@ func Test_echowin_eval()
endfunc endfunc
echowindow ShowMessage() echowindow ShowMessage()
END END
call writefile(lines, 'XtestEchowindow') call writefile(lines, 'XtestEchowindow', 'D')
let buf = RunVimInTerminal('-S XtestEchowindow', #{rows: 8}) let buf = RunVimInTerminal('-S XtestEchowindow', #{rows: 8})
call VerifyScreenDump(buf, 'Test_echowin_eval', {}) call VerifyScreenDump(buf, 'Test_echowin_eval', {})
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XtestEchowindow')
endfunc endfunc
" messages window should not be used for showing the mode " messages window should not be used for showing the mode

View File

@ -1098,14 +1098,13 @@ func Test_mksession_shortmess_with_A()
bwipe! bwipe!
" Recreate the swap file to pretend the file is being edited " Recreate the swap file to pretend the file is being edited
call writefile(cont, fname) call writefile(cont, fname, 'D')
set shortmess+=A set shortmess+=A
source Xtestsession source Xtestsession
set shortmess& set shortmess&
set sessionoptions& set sessionoptions&
call delete('Xtestsession') call delete('Xtestsession')
call delete(fname)
endfunc endfunc
" Test for mksession with 'compatible' option " Test for mksession with 'compatible' option
@ -1235,7 +1234,7 @@ endfunc
" Test for creating views with manual folds " Test for creating views with manual folds
func Test_mkview_manual_fold() func Test_mkview_manual_fold()
call writefile(range(1,10), 'Xmkvfile') call writefile(range(1,10), 'Xmkvfile', 'D')
new Xmkvfile new Xmkvfile
" create recursive folds " create recursive folds
5,6fold 5,6fold
@ -1259,7 +1258,6 @@ func Test_mkview_manual_fold()
source Xview source Xview
call assert_equal([-1, -1, -1, -1, -1, -1], [foldclosed(3), foldclosed(4), call assert_equal([-1, -1, -1, -1, -1, -1], [foldclosed(3), foldclosed(4),
\ foldclosed(5), foldclosed(6), foldclosed(7), foldclosed(8)]) \ foldclosed(5), foldclosed(6), foldclosed(7), foldclosed(8)])
call delete('Xmkvfile')
call delete('Xview') call delete('Xview')
bw! bw!
endfunc endfunc

View File

@ -4,7 +4,7 @@ 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', 'D')
let modeline = &modeline let modeline = &modeline
set modeline set modeline
call assert_fails('split Xmodeline', 'E518:') call assert_fails('split Xmodeline', 'E518:')
@ -29,11 +29,10 @@ func Test_modeline_invalid()
let &modeline = modeline let &modeline = modeline
bwipe! bwipe!
call delete('Xmodeline')
endfunc endfunc
func Test_modeline_filetype() func Test_modeline_filetype()
call writefile(['vim: set ft=c :', 'nothing'], 'Xmodeline_filetype') call writefile(['vim: set ft=c :', 'nothing'], 'Xmodeline_filetype', 'D')
let modeline = &modeline let modeline = &modeline
set modeline set modeline
filetype plugin on filetype plugin on
@ -43,13 +42,12 @@ func Test_modeline_filetype()
call assert_equal("ccomplete#Complete", &ofu) call assert_equal("ccomplete#Complete", &ofu)
bwipe! bwipe!
call delete('Xmodeline_filetype')
let &modeline = modeline let &modeline = modeline
filetype plugin off filetype plugin off
endfunc endfunc
func Test_modeline_syntax() func Test_modeline_syntax()
call writefile(['vim: set syn=c :', 'nothing'], 'Xmodeline_syntax') call writefile(['vim: set syn=c :', 'nothing'], 'Xmodeline_syntax', 'D')
let modeline = &modeline let modeline = &modeline
set modeline set modeline
syntax enable syntax enable
@ -58,14 +56,13 @@ func Test_modeline_syntax()
call assert_equal("c", b:current_syntax) call assert_equal("c", b:current_syntax)
bwipe! bwipe!
call delete('Xmodeline_syntax')
let &modeline = modeline let &modeline = modeline
syntax off syntax off
endfunc endfunc
func Test_modeline_keymap() func Test_modeline_keymap()
CheckFeature keymap CheckFeature keymap
call writefile(['vim: set keymap=greek :', 'nothing'], 'Xmodeline_keymap') call writefile(['vim: set keymap=greek :', 'nothing'], 'Xmodeline_keymap', 'D')
let modeline = &modeline let modeline = &modeline
set modeline set modeline
split Xmodeline_keymap split Xmodeline_keymap
@ -73,7 +70,6 @@ func Test_modeline_keymap()
call assert_match('greek\|grk', b:keymap_name) call assert_match('greek\|grk', b:keymap_name)
bwipe! bwipe!
call delete('Xmodeline_keymap')
let &modeline = modeline let &modeline = modeline
set keymap= iminsert=0 imsearch=-1 set keymap= iminsert=0 imsearch=-1
endfunc endfunc
@ -83,7 +79,7 @@ func Test_modeline_version()
set modeline set modeline
" Test with vim:{vers}: (version {vers} or later). " Test with vim:{vers}: (version {vers} or later).
call writefile(['// vim' .. v:version .. ': ts=2:'], 'Xmodeline_version') call writefile(['// vim' .. v:version .. ': ts=2:'], 'Xmodeline_version', 'D')
edit Xmodeline_version edit Xmodeline_version
call assert_equal(2, &ts) call assert_equal(2, &ts)
bwipe! bwipe!
@ -147,14 +143,13 @@ func Test_modeline_version()
bwipe! bwipe!
let &modeline = modeline let &modeline = modeline
call delete('Xmodeline_version')
endfunc endfunc
func Test_modeline_colon() func Test_modeline_colon()
let modeline = &modeline let modeline = &modeline
set modeline set modeline
call writefile(['// vim: set showbreak=\: ts=2: sw=2'], 'Xmodeline_colon') call writefile(['// vim: set showbreak=\: ts=2: sw=2'], 'Xmodeline_colon', 'D')
edit Xmodeline_colon edit Xmodeline_colon
" backlash colon should become colon. " backlash colon should become colon.
@ -166,13 +161,12 @@ func Test_modeline_colon()
call assert_equal(8, &sw) call assert_equal(8, &sw)
let &modeline = modeline let &modeline = modeline
call delete('Xmodeline_colon')
endfunc endfunc
func s:modeline_fails(what, text, error) func s:modeline_fails(what, text, error)
call CheckOption(a:what) call CheckOption(a:what)
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, 'D')
let modeline = &modeline let modeline = &modeline
set modeline set modeline
filetype plugin on filetype plugin on
@ -182,7 +176,6 @@ func s:modeline_fails(what, text, error)
call assert_equal("", &syntax) call assert_equal("", &syntax)
bwipe! bwipe!
call delete(fname)
let &modeline = modeline let &modeline = modeline
filetype plugin off filetype plugin off
syntax off syntax off
@ -292,7 +285,7 @@ func Test_modeline_setoption_verbose()
7 seven 7 seven
8 eight 8 eight
END END
call writefile(lines, 'Xmodeline') call writefile(lines, 'Xmodeline', 'D')
edit Xmodeline edit Xmodeline
let info = split(execute('verbose set tabstop?'), "\n") let info = split(execute('verbose set tabstop?'), "\n")
call assert_match('^\s*Last set from modeline line 1$', info[-1]) call assert_match('^\s*Last set from modeline line 1$', info[-1])
@ -331,7 +324,6 @@ func Test_modeline_setoption_verbose()
bwipe! bwipe!
let &modeline = modeline let &modeline = modeline
call delete('Xmodeline')
endfunc endfunc
" Test for the 'modeline' default value in compatible and non-compatible modes " Test for the 'modeline' default value in compatible and non-compatible modes
@ -350,22 +342,20 @@ endfunc
" Some options cannot be set from the modeline when 'diff' option is set " Some options cannot be set from the modeline when 'diff' option is set
func Test_modeline_diff_buffer() func Test_modeline_diff_buffer()
call writefile(['vim: diff foldmethod=marker wrap'], 'Xmdifile') call writefile(['vim: diff foldmethod=marker wrap'], 'Xmdifile', 'D')
set foldmethod& nowrap set foldmethod& nowrap
new Xmdifile new Xmdifile
call assert_equal('manual', &foldmethod) call assert_equal('manual', &foldmethod)
call assert_false(&wrap) call assert_false(&wrap)
set wrap& set wrap&
call delete('Xmdifile')
bw bw
endfunc endfunc
func Test_modeline_disable() func Test_modeline_disable()
set modeline set modeline
call writefile(['vim: sw=2', 'vim: nomodeline', 'vim: sw=3'], 'Xmodeline_disable') call writefile(['vim: sw=2', 'vim: nomodeline', 'vim: sw=3'], 'Xmodeline_disable', 'D')
edit Xmodeline_disable edit Xmodeline_disable
call assert_equal(2, &sw) call assert_equal(2, &sw)
call delete('Xmodeline_disable')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@ -41,8 +41,7 @@ func ReadXnetbeans()
endfunc endfunc
func Nb_basic(port) func Nb_basic(port)
call delete("Xnetbeans") call writefile([], "Xnetbeans", 'D')
call writefile([], "Xnetbeans")
" Last line number in the Xnetbeans file. Used to verify the result of the " Last line number in the Xnetbeans file. Used to verify the result of the
" communication with the netbeans server " communication with the netbeans server
@ -79,7 +78,7 @@ func Nb_basic(port)
sleep 1m sleep 1m
" getCursor test " getCursor test
call writefile(['foo bar', 'foo bar', 'foo bar'], 'Xfile1') call writefile(['foo bar', 'foo bar', 'foo bar'], 'Xfile1', 'D')
split Xfile1 split Xfile1
call cursor(3, 4) call cursor(3, 4)
sleep 10m sleep 10m
@ -272,7 +271,7 @@ func Nb_basic(port)
let g:last += 4 let g:last += 4
" editFile test " editFile test
call writefile(['foo bar1', 'foo bar2', 'foo bar3'], 'Xfile3') call writefile(['foo bar1', 'foo bar2', 'foo bar3'], 'Xfile3', 'D')
call appendbufline(cmdbufnr, '$', 'editFile_Test') call appendbufline(cmdbufnr, '$', 'editFile_Test')
call WaitFor('len(ReadXnetbeans()) >= (g:last + 4)') call WaitFor('len(ReadXnetbeans()) >= (g:last + 4)')
let l = ReadXnetbeans() let l = ReadXnetbeans()
@ -838,9 +837,6 @@ func Nb_basic(port)
call sign_unplace('*') call sign_unplace('*')
call sign_undefine() call sign_undefine()
call delete("Xnetbeans")
call delete('Xfile1')
call delete('Xfile3')
call delete('Xfile4') call delete('Xfile4')
endfunc endfunc
@ -851,10 +847,10 @@ endfunc
func Nb_file_auth(port) func Nb_file_auth(port)
call delete("Xnetbeans") call delete("Xnetbeans")
call writefile([], "Xnetbeans") call writefile([], "Xnetbeans", 'D')
call assert_fails('nbstart =notexist', 'E660:') call assert_fails('nbstart =notexist', 'E660:')
call writefile(['host=localhost', 'port=' . a:port, 'auth=bunny'], 'Xnbauth') call writefile(['host=localhost', 'port=' . a:port, 'auth=bunny'], 'Xnbauth', 'D')
if has('unix') if has('unix')
call setfperm('Xnbauth', "rw-r--r--") call setfperm('Xnbauth', "rw-r--r--")
call assert_fails('nbstart =Xnbauth', 'E668:') call assert_fails('nbstart =Xnbauth', 'E668:')
@ -871,7 +867,6 @@ func Nb_file_auth(port)
call assert_equal('0:startupDone=0', lines[2]) call assert_equal('0:startupDone=0', lines[2])
call delete("Xnbauth") call delete("Xnbauth")
call delete("Xnetbeans")
endfunc endfunc
func Test_nb_file_auth() func Test_nb_file_auth()
@ -882,7 +877,7 @@ endfunc
" Test for quitting Vim with an open netbeans connection " Test for quitting Vim with an open netbeans connection
func Nb_quit_with_conn(port) func Nb_quit_with_conn(port)
call delete("Xnetbeans") call delete("Xnetbeans")
call writefile([], "Xnetbeans") call writefile([], "Xnetbeans", 'D')
let after =<< trim END let after =<< trim END
source shared.vim source shared.vim
set cpo&vim set cpo&vim
@ -922,7 +917,6 @@ func Nb_quit_with_conn(port)
call assert_equal('1:killed=16', l[-2]) call assert_equal('1:killed=16', l[-2])
call assert_equal('0:disconnect=16', l[-1]) call assert_equal('0:disconnect=16', l[-1])
endif endif
call delete('Xnetbeans')
endfunc endfunc
func Test_nb_quit_with_conn() func Test_nb_quit_with_conn()

View File

@ -299,7 +299,7 @@ func Test_normal06_formatprg()
CheckNotMSWindows CheckNotMSWindows
" uses sed to number non-empty lines " uses sed to number non-empty lines
call writefile(['#!/bin/sh', 'sed ''/./=''|sed ''/./{', 'N', 's/\n/ /', '}'''], 'Xsed_format.sh') call writefile(['#!/bin/sh', 'sed ''/./=''|sed ''/./{', 'N', 's/\n/ /', '}'''], 'Xsed_format.sh', 'D')
call system('chmod +x ./Xsed_format.sh') call system('chmod +x ./Xsed_format.sh')
let text = ['a', '', 'c', '', ' ', 'd', 'e'] let text = ['a', '', 'c', '', ' ', 'd', 'e']
let expected = ['1 a', '', '3 c', '', '5 ', '6 d', '7 e'] let expected = ['1 a', '', '3 c', '', '5 ', '6 d', '7 e']
@ -330,7 +330,6 @@ func Test_normal06_formatprg()
" clean up " clean up
set formatprg= set formatprg=
setlocal formatprg= setlocal formatprg=
call delete('Xsed_format.sh')
endfunc endfunc
func Test_normal07_internalfmt() func Test_normal07_internalfmt()
@ -702,11 +701,10 @@ func Test_opfunc_callback()
call writefile([execute('messages')], 'Xtest.out') call writefile([execute('messages')], 'Xtest.out')
qall qall
END END
call writefile(cleanup, 'Xverify.vim') call writefile(cleanup, 'Xverify.vim', 'D')
call RunVim([], [], "-c \"set opfunc=s:abc\" -S Xverify.vim") call RunVim([], [], "-c \"set opfunc=s:abc\" -S Xverify.vim")
call assert_match('E81: Using <SID> not in a', readfile('Xtest.out')[0]) call assert_match('E81: Using <SID> not in a', readfile('Xtest.out')[0])
call delete('Xtest.out') call delete('Xtest.out')
call delete('Xverify.vim')
" cleanup " cleanup
set opfunc& set opfunc&
@ -1292,11 +1290,10 @@ func Test_scroll_in_ex_mode()
call writefile(['done'], 'Xdone') call writefile(['done'], 'Xdone')
qa! qa!
END END
call writefile(lines, 'Xscript') call writefile(lines, 'Xscript', 'D')
call assert_equal(1, RunVim([], [], '--clean -X -Z -e -s -S Xscript')) call assert_equal(1, RunVim([], [], '--clean -X -Z -e -s -S Xscript'))
call assert_equal(['done'], readfile('Xdone')) call assert_equal(['done'], readfile('Xdone'))
call delete('Xscript')
call delete('Xdone') call delete('Xdone')
endfunc endfunc
@ -1709,16 +1706,14 @@ endfunc
func Test_normal20_exmode() func Test_normal20_exmode()
" Reading from redirected file doesn't work on MS-Windows " Reading from redirected file doesn't work on MS-Windows
CheckNotMSWindows CheckNotMSWindows
call writefile(['1a', 'foo', 'bar', '.', 'w! Xn20file2', 'q!'], 'Xn20script') call writefile(['1a', 'foo', 'bar', '.', 'w! Xn20file2', 'q!'], 'Xn20script', 'D')
call writefile(['1', '2'], 'Xn20file') call writefile(['1', '2'], 'Xn20file', 'D')
call system(GetVimCommand() .. ' -e -s < Xn20script Xn20file') call system(GetVimCommand() .. ' -e -s < Xn20script Xn20file')
let a = readfile('Xn20file2') let a = readfile('Xn20file2')
call assert_equal(['1', 'foo', 'bar', '2'], a) call assert_equal(['1', 'foo', 'bar', '2'], a)
" clean up " clean up
for file in ['Xn20file', 'Xn20file2', 'Xn20script'] call delete('Xn20file2')
call delete(file)
endfor
bw! bw!
endfunc endfunc
@ -1758,7 +1753,7 @@ func Test_normal22_zet()
" Test for ZZ " Test for ZZ
" let shell = &shell " let shell = &shell
" let &shell = 'sh' " let &shell = 'sh'
call writefile(['1', '2'], 'Xn22file') call writefile(['1', '2'], 'Xn22file', 'D')
let args = ' -N -i NONE --noplugins -X --not-a-term' let args = ' -N -i NONE --noplugins -X --not-a-term'
call system(GetVimCommand() .. args .. ' -c "%d" -c ":norm! ZZ" Xn22file') call system(GetVimCommand() .. args .. ' -c "%d" -c ":norm! ZZ" Xn22file')
let a = readfile('Xn22file') let a = readfile('Xn22file')
@ -1773,9 +1768,6 @@ func Test_normal22_zet()
call assert_beeps('normal! ZW') call assert_beeps('normal! ZW')
" clean up " clean up
for file in ['Xn22file']
call delete(file)
endfor
" let &shell = shell " let &shell = shell
endfunc endfunc
@ -3141,7 +3133,7 @@ func Test_normal51_FileChangedRO()
CheckFeature autocmd CheckFeature autocmd
" Don't sleep after the warning message. " Don't sleep after the warning message.
call test_settime(1) call test_settime(1)
call writefile(['foo'], 'Xreadonly.log') call writefile(['foo'], 'Xreadonly.log', 'D')
new Xreadonly.log new Xreadonly.log
setl ro setl ro
au FileChangedRO <buffer> :call feedkeys("\<c-^>", 'tix') au FileChangedRO <buffer> :call feedkeys("\<c-^>", 'tix')
@ -3152,7 +3144,6 @@ func Test_normal51_FileChangedRO()
" cleanup " cleanup
call test_settime(0) call test_settime(0)
bw! bw!
call delete("Xreadonly.log")
endfunc endfunc
func Test_normal52_rl() func Test_normal52_rl()

View File

@ -276,7 +276,7 @@ func Test_relativenumber_colors()
set number relativenumber set number relativenumber
hi LineNr ctermfg=red hi LineNr ctermfg=red
[CODE] [CODE]
call writefile(lines, 'XTest_relnr') call writefile(lines, 'XTest_relnr', 'D')
" Check that the balloon shows up after a mouse move " Check that the balloon shows up after a mouse move
let buf = RunVimInTerminal('-S XTest_relnr', {'rows': 10, 'cols': 50}) let buf = RunVimInTerminal('-S XTest_relnr', {'rows': 10, 'cols': 50})
@ -295,7 +295,6 @@ func Test_relativenumber_colors()
" clean up " clean up
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_relnr')
endfunc endfunc
func Test_relativenumber_callback() func Test_relativenumber_callback()
@ -313,14 +312,13 @@ func Test_relativenumber_callback()
call timer_start(300, 'Func') call timer_start(300, 'Func')
END END
call writefile(lines, 'Xrnu_timer') call writefile(lines, 'Xrnu_timer', 'D')
let buf = RunVimInTerminal('-S Xrnu_timer', #{rows: 8}) let buf = RunVimInTerminal('-S Xrnu_timer', #{rows: 8})
call TermWait(buf, 310) call TermWait(buf, 310)
call VerifyScreenDump(buf, 'Test_relativenumber_callback_1', {}) call VerifyScreenDump(buf, 'Test_relativenumber_callback_1', {})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('Xrnu_timer')
endfunc endfunc
" Test for displaying line numbers with 'rightleft' " Test for displaying line numbers with 'rightleft'

View File

@ -699,6 +699,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 */
/**/
626,
/**/ /**/
625, 625,
/**/ /**/