Patch 8.2.2169
Problem: Vim9: test leaves file behind.
Solution: Rename script files. (Dominique Pellé, closes #7511)
Use try/finally.
Files: src/testdir/test_vim9_script.vim, src/testdir/vim9.vim
*** ../vim-8.2.2168/src/testdir/test_vim9_script.vim 2020-12-19
21:23:38.797667072 +0100
--- src/testdir/test_vim9_script.vim 2020-12-20 15:34:55.301013355 +0100
***************
*** 2412,2418 ****
'delcommand Echo',
])
CheckScriptSuccess([
! 'vim9script'
'command Echo cd # comment',
'Echo',
'delcommand Echo',
--- 2412,2418 ----
'delcommand Echo',
])
CheckScriptSuccess([
! 'vim9script',
'command Echo cd # comment',
'Echo',
'delcommand Echo',
***************
*** 2949,2954 ****
--- 2949,2955 ----
endif
delete('Xsourced')
delete('Xclose')
+ delete('Xdone')
enddef
*** ../vim-8.2.2168/src/testdir/vim9.vim 2020-12-05 13:40:57.495035088
+0100
--- src/testdir/vim9.vim 2020-12-20 15:41:23.523734126 +0100
***************
*** 5,17 ****
" Check that "lines" inside a ":def" function has no error.
func CheckDefSuccess(lines)
! let fname = 'Xdef' .. s:sequence
let s:sequence += 1
call writefile(['def Func()'] + a:lines + ['enddef', 'defcompile'], fname)
! exe 'so ' .. fname
! call Func()
! delfunc! Func
! call delete(fname)
endfunc
" Check that "lines" inside ":def" results in an "error" message.
--- 5,22 ----
" Check that "lines" inside a ":def" function has no error.
func CheckDefSuccess(lines)
! let cwd = getcwd()
! let fname = 'XdefSuccess' .. s:sequence
let s:sequence += 1
call writefile(['def Func()'] + a:lines + ['enddef', 'defcompile'], fname)
! try
! exe 'so ' .. fname
! call Func()
! delfunc! Func
! finally
! call chdir(cwd)
! call delete(fname)
! endtry
endfunc
" Check that "lines" inside ":def" results in an "error" message.
***************
*** 19,30 ****
" Add a line before and after to make it less likely that the line number is
" accidentally correct.
func CheckDefFailure(lines, error, lnum = -3)
! let fname = 'Xdef' .. s:sequence
! call writefile(['def Func()', '# comment'] + a:lines + ['#comment',
'enddef', 'defcompile'], fname)
! call assert_fails('so ' .. fname, a:error, a:lines, a:lnum + 1)
! delfunc! Func
! call delete(fname)
let s:sequence += 1
endfunc
" Check that "lines" inside ":def" results in an "error" message when
executed.
--- 24,40 ----
" Add a line before and after to make it less likely that the line number is
" accidentally correct.
func CheckDefFailure(lines, error, lnum = -3)
! let cwd = getcwd()
! let fname = 'XdefFailure' .. s:sequence
let s:sequence += 1
+ call writefile(['def Func()', '# comment'] + a:lines + ['#comment',
'enddef', 'defcompile'], fname)
+ try
+ call assert_fails('so ' .. fname, a:error, a:lines, a:lnum + 1)
+ finally
+ call chdir(cwd)
+ call delete(fname)
+ delfunc! Func
+ endtry
endfunc
" Check that "lines" inside ":def" results in an "error" message when
executed.
***************
*** 32,60 ****
" Add a line before and after to make it less likely that the line number is
" accidentally correct.
func CheckDefExecFailure(lines, error, lnum = -3)
! let fname = 'Xdef' .. s:sequence
let s:sequence += 1
call writefile(['def Func()', '# comment'] + a:lines + ['#comment',
'enddef'], fname)
! exe 'so ' .. fname
! call assert_fails('call Func()', a:error, a:lines, a:lnum + 1)
! delfunc! Func
! call delete(fname)
endfunc
def CheckScriptFailure(lines: list<string>, error: string, lnum = -3)
! var fname = 'Xdef' .. s:sequence
s:sequence += 1
writefile(lines, fname)
! assert_fails('so ' .. fname, error, lines, lnum)
! delete(fname)
enddef
def CheckScriptSuccess(lines: list<string>)
! var fname = 'Xdef' .. s:sequence
s:sequence += 1
writefile(lines, fname)
! exe 'so ' .. fname
! delete(fname)
enddef
def CheckDefAndScriptSuccess(lines: list<string>)
--- 42,85 ----
" Add a line before and after to make it less likely that the line number is
" accidentally correct.
func CheckDefExecFailure(lines, error, lnum = -3)
! let cwd = getcwd()
! let fname = 'XdefExecFailure' .. s:sequence
let s:sequence += 1
call writefile(['def Func()', '# comment'] + a:lines + ['#comment',
'enddef'], fname)
! try
! exe 'so ' .. fname
! call assert_fails('call Func()', a:error, a:lines, a:lnum + 1)
! finally
! call chdir(cwd)
! call delete(fname)
! delfunc! Func
! endtry
endfunc
def CheckScriptFailure(lines: list<string>, error: string, lnum = -3)
! var cwd = getcwd()
! var fname = 'XScriptFailure' .. s:sequence
s:sequence += 1
writefile(lines, fname)
! try
! assert_fails('so ' .. fname, error, lines, lnum)
! finally
! chdir(cwd)
! delete(fname)
! endtry
enddef
def CheckScriptSuccess(lines: list<string>)
! var cwd = getcwd()
! var fname = 'XScriptSuccess' .. s:sequence
s:sequence += 1
writefile(lines, fname)
! try
! exe 'so ' .. fname
! finally
! chdir(cwd)
! delete(fname)
! endtry
enddef
def CheckDefAndScriptSuccess(lines: list<string>)
*** ../vim-8.2.2168/src/version.c 2020-12-20 15:20:53.326899494 +0100
--- src/version.c 2020-12-20 15:31:00.845709634 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2169,
/**/
--
For large projects, Team Leaders use sophisticated project management software
to keep track of who's doing what. The software collects the lies and guesses
of the project team and organizes them in to instantly outdated charts that
are too boring to look at closely. This is called "planning".
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202012201443.0BKEhtp11909221%40masaka.moolenaar.net.