diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-04-14 13:51:55 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-04-14 13:51:55 +0200 |
commit | 78a16b0f2a142aae1fdc96c50ab0f25194d0e755 (patch) | |
tree | 2980fc918579aba91215787b3ce7f535708d4ad4 /src/testdir/test_eval_stuff.vim | |
parent | 98da6ecab905df48a67da36ce60233f45726c979 (diff) | |
download | vim-git-78a16b0f2a142aae1fdc96c50ab0f25194d0e755.tar.gz |
patch 8.0.1708: mkdir with 'p' flag fails on existing directoryv8.0.1708
Problem: Mkdir with 'p' flag fails on existing directory, which is
different from the mkdir shell command.
Solution: Don't fail if the directory already exists. (James McCoy,
closes #2775)
Diffstat (limited to 'src/testdir/test_eval_stuff.vim')
-rw-r--r-- | src/testdir/test_eval_stuff.vim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim index 12222303d..41ba1374d 100644 --- a/src/testdir/test_eval_stuff.vim +++ b/src/testdir/test_eval_stuff.vim @@ -25,3 +25,20 @@ func Test_nocatch_restore_silent_emsg() let c5 = nr2char(screenchar(&lines, 5)) call assert_equal('wrong', c1 . c2 . c3 . c4 . c5) endfunc + +func Test_mkdir_p() + call mkdir('Xmkdir/nested', 'p') + call assert_true(isdirectory('Xmkdir/nested')) + try + " Trying to make existing directories doesn't error + call mkdir('Xmkdir', 'p') + call mkdir('Xmkdir/nested', 'p') + catch /E739:/ + call assert_report('mkdir(..., "p") failed for an existing directory') + endtry + " 'p' doesn't suppress real errors + call writefile([], 'Xfile') + call assert_fails('call mkdir("Xfile", "p")', 'E739') + call delete('Xfile') + call delete('Xmkdir', 'rf') +endfunc |