To: vim_dev@googlegroups.com Subject: Patch 7.4.1179 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1179 Problem: test_writefile and test_viml do not delete the tempfile. Solution: Delete the tempfile. (Charles Cooper) Add DeleteTheScript(). Files: src/testdir/test_writefile.in, src/testdir/test_viml.vim *** ../vim-7.4.1178/src/testdir/test_writefile.in 2014-11-05 18:05:48.660441306 +0100 --- src/testdir/test_writefile.in 2016-01-25 20:26:50.923756699 +0100 *************** *** 13,18 **** --- 13,19 ---- :$put =readfile(f) :1 delete _ :w! test.out + :call delete(f) :qa! ENDTEST *** ../vim-7.4.1178/src/testdir/test_viml.vim 2016-01-25 20:22:49.966245416 +0100 --- src/testdir/test_viml.vim 2016-01-25 20:34:24.251050807 +0100 *************** *** 55,70 **** " ExecAsScript - Source a temporary script made from a function. {{{2 " " Make a temporary script file from the function a:funcname, ":source" it, and ! " delete it afterwards. function! ExecAsScript(funcname) " Make a script from the function passed as argument. ! let script = MakeScript(a:funcname) " Source and delete the script. ! exec "source" script ! call delete(script) endfunction com! -nargs=1 -bar ExecAsScript call ExecAsScript() --- 55,80 ---- " ExecAsScript - Source a temporary script made from a function. {{{2 " " Make a temporary script file from the function a:funcname, ":source" it, and ! " 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) " Make a script from the function passed as argument. ! let s:script_name = MakeScript(a:funcname) " Source and delete the script. ! exec "source" s:script_name ! call delete(s:script_name) ! let s:script_name = '' 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() *************** *** 143,148 **** --- 153,159 ---- XpathINIT ExecAsScript T1_F Xpath 'F' + call DeleteTheScript() try ExecAsScript T1_G *************** *** 152,157 **** --- 163,169 ---- Xpath 'x' endtry Xpath 'G' + call DeleteTheScript() call assert_equal('abcFhijxG', g:Xpath) endfunc *************** *** 260,265 **** --- 272,278 ---- XpathINIT ExecAsScript T4_F Xpath '5' + call DeleteTheScript() call assert_equal('ab3e3b2c25', g:Xpath) endfunction *** ../vim-7.4.1178/src/version.c 2016-01-25 20:22:49.966245416 +0100 --- src/version.c 2016-01-25 20:34:46.742815925 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 1179, /**/ -- Everybody lies, but it doesn't matter since nobody listens. -- Lieberman's Law /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///