vim-patch:7.4.1179 (#5112)

Problem:    test_writefile and test_viml do not delete the tempfile.
Solution:   Delete the tempfile. (Charles Cooper)  Add DeleteTheScript().

f4f79b84a5
This commit is contained in:
Hirokazu Hata 2016-07-25 21:12:24 +09:00 committed by Justin M. Keyes
parent 2bb4c43f2f
commit fbb2cd791d
3 changed files with 19 additions and 5 deletions

View File

@ -55,16 +55,26 @@ endfunction
" ExecAsScript - Source a temporary script made from a function. {{{2 " ExecAsScript - Source a temporary script made from a function. {{{2
" "
" Make a temporary script file from the function a:funcname, ":source" it, and " Make a temporary script file from the function a:funcname, ":source" it, and
" delete it afterwards. " delete it afterwards. However, if an exception is thrown the file may remain,
" the caller should call DeleteTheScript() afterwards.
let s:script_name = ''
function! ExecAsScript(funcname) function! ExecAsScript(funcname)
" Make a script from the function passed as argument. " Make a script from the function passed as argument.
let script = MakeScript(a:funcname) let s:script_name = MakeScript(a:funcname)
" Source and delete the script. " Source and delete the script.
exec "source" script exec "source" s:script_name
call delete(script) call delete(s:script_name)
let s:script_name = ''
endfunction endfunction
function! DeleteTheScript()
if s:script_name
call delete(s:script_name)
let s:script_name = ''
endif
endfunc
com! -nargs=1 -bar ExecAsScript call ExecAsScript(<f-args>) com! -nargs=1 -bar ExecAsScript call ExecAsScript(<f-args>)
@ -143,6 +153,7 @@ func Test_endwhile_script()
XpathINIT XpathINIT
ExecAsScript T1_F ExecAsScript T1_F
Xpath 'F' Xpath 'F'
call DeleteTheScript()
try try
ExecAsScript T1_G ExecAsScript T1_G
@ -152,6 +163,7 @@ func Test_endwhile_script()
Xpath 'x' Xpath 'x'
endtry endtry
Xpath 'G' Xpath 'G'
call DeleteTheScript()
call assert_equal('abcFhijxG', g:Xpath) call assert_equal('abcFhijxG', g:Xpath)
endfunc endfunc
@ -260,6 +272,7 @@ function Test_finish()
XpathINIT XpathINIT
ExecAsScript T4_F ExecAsScript T4_F
Xpath '5' Xpath '5'
call DeleteTheScript()
call assert_equal('ab3e3b2c25', g:Xpath) call assert_equal('ab3e3b2c25', g:Xpath)
endfunction endfunction

View File

@ -523,7 +523,7 @@ static int included_patches[] = {
// 1182 NA // 1182 NA
1181, 1181,
1180, 1180,
// 1179, 1179,
1178, 1178,
// 1177 NA // 1177 NA
// 1176 NA // 1176 NA

View File

@ -17,6 +17,7 @@ describe('writefile', function()
execute('bwipeout!') execute('bwipeout!')
execute('$put =readfile(f)') execute('$put =readfile(f)')
execute('1 delete _') execute('1 delete _')
execute('call delete(f)')
-- Assert buffer contents. -- Assert buffer contents.
expect([[ expect([[