diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-07-15 05:57:35 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-07-15 06:03:58 +0800 |
commit | 7214fd8f557251745c7499c1f273e3e2871fc060 (patch) | |
tree | 02850f773b5403ab75d25f25e75881c5fc2d52d9 | |
parent | 79130c0fd393e3eef8e4c939c54ea3d3faec2149 (diff) | |
download | rneovim-7214fd8f557251745c7499c1f273e3e2871fc060.tar.gz rneovim-7214fd8f557251745c7499c1f273e3e2871fc060.tar.bz2 rneovim-7214fd8f557251745c7499c1f273e3e2871fc060.zip |
vim-patch:partial:9.0.0418: manually deleting temp test files
Problem: Manually deleting temp test files.
Solution: Use the 'D' flag of writefile() and mkdir().
https://github.com/vim/vim/commit/45bbaef0382c5468d9fac511775bd99ea7bf5b84
This only includes test_cpoptions.vim changes.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | test/old/testdir/test_cpoptions.vim | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/test/old/testdir/test_cpoptions.vim b/test/old/testdir/test_cpoptions.vim index 915f418712..8512edf2e6 100644 --- a/test/old/testdir/test_cpoptions.vim +++ b/test/old/testdir/test_cpoptions.vim @@ -8,7 +8,7 @@ source view_util.vim " file name. func Test_cpo_a() let save_cpo = &cpo - call writefile(['one'], 'XfileCpoA') + call writefile(['one'], 'XfileCpoA', 'D') " Wipe out all the buffers, so that the alternate file is empty edit Xfoo | %bw set cpo-=a @@ -20,7 +20,6 @@ func Test_cpo_a() read XfileCpoA call assert_equal('XfileCpoA', @#) close! - call delete('XfileCpoA') let &cpo = save_cpo endfunc @@ -104,21 +103,20 @@ endfunc " Test for the 'C' flag in 'cpo' (line continuation) func Test_cpo_C() let save_cpo = &cpo - call writefile(['let l = [', '\ 1,', '\ 2]'], 'XfileCpoC') + call writefile(['let l = [', '\ 1,', '\ 2]'], 'XfileCpoC', 'D') set cpo-=C source XfileCpoC call assert_equal([1, 2], g:l) set cpo+=C call assert_fails('source XfileCpoC', ['E697:', 'E10:']) - call delete('XfileCpoC') let &cpo = save_cpo endfunc " Test for the 'd' flag in 'cpo' (tags relative to the current file) func Test_cpo_d() let save_cpo = &cpo - call mkdir('XdirCpoD') - call writefile(["one\tXfile1\t/^one$/"], 'tags') + call mkdir('XdirCpoD', 'R') + call writefile(["one\tXfile1\t/^one$/"], 'tags', 'D') call writefile(["two\tXfile2\t/^two$/"], 'XdirCpoD/tags') set tags=./tags set cpo-=d @@ -126,9 +124,8 @@ func Test_cpo_d() call assert_equal('two', taglist('.*')[0].name) set cpo+=d call assert_equal('one', taglist('.*')[0].name) + %bw! - call delete('tags') - call delete('XdirCpoD', 'rf') set tags& let &cpo = save_cpo endfunc @@ -423,14 +420,13 @@ func Test_cpo_O() let save_cpo = &cpo new XfileCpoO call setline(1, 'one') - call writefile(['two'], 'XfileCpoO') + call writefile(['two'], 'XfileCpoO', 'D') set cpo-=O call assert_fails('write', 'E13:') set cpo+=O write call assert_equal(['one'], readfile('XfileCpoO')) close! - call delete('XfileCpoO') let &cpo = save_cpo endfunc @@ -440,7 +436,7 @@ endfunc " name) func Test_cpo_P() let save_cpo = &cpo - call writefile([], 'XfileCpoP') + call writefile([], 'XfileCpoP', 'D') new call setline(1, 'one') set cpo+=F @@ -452,7 +448,6 @@ func Test_cpo_P() call assert_equal('XfileCpoP', @%) bwipe! - call delete('XfileCpoP') let &cpo = save_cpo endfunc @@ -645,7 +640,7 @@ endfunc " Test for the 'Z' flag in 'cpo' (write! resets 'readonly') func Test_cpo_Z() let save_cpo = &cpo - call writefile([], 'XfileCpoZ') + call writefile([], 'XfileCpoZ', 'D') new XfileCpoZ setlocal readonly set cpo-=Z @@ -656,7 +651,6 @@ func Test_cpo_Z() write! call assert_equal(1, &readonly) close! - call delete('XfileCpoZ') let &cpo = save_cpo endfunc @@ -735,7 +729,7 @@ endfunc " flag) func Test_cpo_plus() let save_cpo = &cpo - call writefile([], 'XfileCpoPlus') + call writefile([], 'XfileCpoPlus', 'D') new XfileCpoPlus call setline(1, 'foo') write X1 @@ -744,7 +738,6 @@ func Test_cpo_plus() write X2 call assert_equal(0, &modified) close! - call delete('XfileCpoPlus') call delete('X1') call delete('X2') let &cpo = save_cpo @@ -850,7 +843,7 @@ endfunc " loaded and ':preserve' is used. func Test_cpo_ampersand() throw 'Skipped: Nvim does not support cpoptions flag "&"' - call writefile(['one'], 'XfileCpoAmp') + call writefile(['one'], 'XfileCpoAmp', 'D') let after =<< trim [CODE] set cpo+=& preserve @@ -860,7 +853,6 @@ func Test_cpo_ampersand() call assert_equal(1, filereadable('.XfileCpoAmp.swp')) call delete('.XfileCpoAmp.swp') endif - call delete('XfileCpoAmp') endfunc " Test for the '\' flag in 'cpo' (backslash in a [] range in a search pattern) |