mirror of
https://github.com/neovim/neovim.git
synced 2026-07-22 00:51:33 +00:00
vim-patch:9.0.0411: only created files can be cleaned up with one call
Problem: Only created files can be cleaned up with one call.
Solution: Add flags to mkdir() to delete with a deferred function.
Expand the writefile() name to a full path to handle changing
directory.
6f14da15ac
vim-patch:8.2.3742: dec mouse test fails without gnome terminfo entry
Problem: Dec mouse test fails without gnome terminfo entry.
Solution: Check if there is a gnome entry. Also fix 'acd' test on
MS-Windows. (Dominique Pellé, closes vim/vim#9282)
f589fd3e10
Cherry-pick test_autochdir.vim changes from patch 9.0.0313.
Cherry-pick test_autocmd.vim changes from patch 9.0.0323.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -36,12 +36,70 @@ func Test_mkdir_p()
|
||||
endtry
|
||||
" 'p' doesn't suppress real errors
|
||||
call writefile([], 'Xfile')
|
||||
call assert_fails('call mkdir("Xfile", "p")', 'E739')
|
||||
call assert_fails('call mkdir("Xfile", "p")', 'E739:')
|
||||
call delete('Xfile')
|
||||
call delete('Xmkdir', 'rf')
|
||||
call assert_equal(0, mkdir(v:_null_string))
|
||||
call assert_fails('call mkdir([])', 'E730')
|
||||
call assert_fails('call mkdir("abc", [], [])', 'E745')
|
||||
call assert_fails('call mkdir([])', 'E730:')
|
||||
call assert_fails('call mkdir("abc", [], [])', 'E745:')
|
||||
endfunc
|
||||
|
||||
func DoMkdirDel(name)
|
||||
call mkdir(a:name, 'pD')
|
||||
call assert_true(isdirectory(a:name))
|
||||
endfunc
|
||||
|
||||
func DoMkdirDelAddFile(name)
|
||||
call mkdir(a:name, 'pD')
|
||||
call assert_true(isdirectory(a:name))
|
||||
call writefile(['text'], a:name .. '/file')
|
||||
endfunc
|
||||
|
||||
func DoMkdirDelRec(name)
|
||||
call mkdir(a:name, 'pR')
|
||||
call assert_true(isdirectory(a:name))
|
||||
endfunc
|
||||
|
||||
func DoMkdirDelRecAddFile(name)
|
||||
call mkdir(a:name, 'pR')
|
||||
call assert_true(isdirectory(a:name))
|
||||
call writefile(['text'], a:name .. '/file')
|
||||
endfunc
|
||||
|
||||
func Test_mkdir_defer_del()
|
||||
" Xtopdir/tmp is created thus deleted, not Xtopdir itself
|
||||
call mkdir('Xtopdir', 'R')
|
||||
call DoMkdirDel('Xtopdir/tmp')
|
||||
call assert_true(isdirectory('Xtopdir'))
|
||||
call assert_false(isdirectory('Xtopdir/tmp'))
|
||||
|
||||
" Deletion fails because "tmp" contains "sub"
|
||||
call DoMkdirDel('Xtopdir/tmp/sub')
|
||||
call assert_true(isdirectory('Xtopdir'))
|
||||
call assert_true(isdirectory('Xtopdir/tmp'))
|
||||
call delete('Xtopdir/tmp', 'rf')
|
||||
|
||||
" Deletion fails because "tmp" contains "file"
|
||||
call DoMkdirDelAddFile('Xtopdir/tmp')
|
||||
call assert_true(isdirectory('Xtopdir'))
|
||||
call assert_true(isdirectory('Xtopdir/tmp'))
|
||||
call assert_true(filereadable('Xtopdir/tmp/file'))
|
||||
call delete('Xtopdir/tmp', 'rf')
|
||||
|
||||
" Xtopdir/tmp is created thus deleted, not Xtopdir itself
|
||||
call DoMkdirDelRec('Xtopdir/tmp')
|
||||
call assert_true(isdirectory('Xtopdir'))
|
||||
call assert_false(isdirectory('Xtopdir/tmp'))
|
||||
|
||||
" Deletion works even though "tmp" contains "sub"
|
||||
call DoMkdirDelRec('Xtopdir/tmp/sub')
|
||||
call assert_true(isdirectory('Xtopdir'))
|
||||
call assert_false(isdirectory('Xtopdir/tmp'))
|
||||
|
||||
" Deletion works even though "tmp" contains "file"
|
||||
call DoMkdirDelRecAddFile('Xtopdir/tmp')
|
||||
call assert_true(isdirectory('Xtopdir'))
|
||||
call assert_false(isdirectory('Xtopdir/tmp'))
|
||||
endfunc
|
||||
|
||||
func Test_line_continuation()
|
||||
|
||||
Reference in New Issue
Block a user