diff options
author | Hirokazu Hata <h-michael@users.noreply.github.com> | 2016-07-25 21:12:24 +0900 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-07-25 08:12:24 -0400 |
commit | fbb2cd791d0c79a52bd7fcf9e3a569fa9d306b6a (patch) | |
tree | 428dc3d00a8a965a5a8754dbdb726cfe08eae5d7 /src | |
parent | 2bb4c43f2faf043f828cf98c1354ab3a2b380fa4 (diff) | |
download | rneovim-fbb2cd791d0c79a52bd7fcf9e3a569fa9d306b6a.tar.gz rneovim-fbb2cd791d0c79a52bd7fcf9e3a569fa9d306b6a.tar.bz2 rneovim-fbb2cd791d0c79a52bd7fcf9e3a569fa9d306b6a.zip |
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().
https://github.com/vim/vim/commit/f4f79b84a5595c511f6fdbe4e3e1d188d97879a0
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_viml.vim | 21 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/nvim/testdir/test_viml.vim b/src/nvim/testdir/test_viml.vim index 2d989cdad9..c39c5e6b28 100644 --- a/src/nvim/testdir/test_viml.vim +++ b/src/nvim/testdir/test_viml.vim @@ -55,16 +55,26 @@ endfunction " 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. +" 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 script = MakeScript(a:funcname) + let s:script_name = MakeScript(a:funcname) " Source and delete the script. - exec "source" script - call delete(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(<f-args>) @@ -143,6 +153,7 @@ func Test_endwhile_script() XpathINIT ExecAsScript T1_F Xpath 'F' + call DeleteTheScript() try ExecAsScript T1_G @@ -152,6 +163,7 @@ func Test_endwhile_script() Xpath 'x' endtry Xpath 'G' + call DeleteTheScript() call assert_equal('abcFhijxG', g:Xpath) endfunc @@ -260,6 +272,7 @@ function Test_finish() XpathINIT ExecAsScript T4_F Xpath '5' + call DeleteTheScript() call assert_equal('ab3e3b2c25', g:Xpath) endfunction diff --git a/src/nvim/version.c b/src/nvim/version.c index 921491db75..4a17660cd5 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -523,7 +523,7 @@ static int included_patches[] = { // 1182 NA 1181, 1180, - // 1179, + 1179, 1178, // 1177 NA // 1176 NA |