From 4b287119fe798da1ca1ae5b96f6503972ed3a229 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 3 May 2019 00:15:56 -0400 Subject: vim-patch:8.0.1708: mkdir with 'p' flag fails on existing directory 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 vim/vim#2775) https://github.com/vim/vim/commit/78a16b0f2a142aae1fdc96c50ab0f25194d0e755 --- src/nvim/testdir/test_eval_stuff.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/nvim/testdir/test_eval_stuff.vim') diff --git a/src/nvim/testdir/test_eval_stuff.vim b/src/nvim/testdir/test_eval_stuff.vim index 111c85bb95..a99b7e9c0b 100644 --- a/src/nvim/testdir/test_eval_stuff.vim +++ b/src/nvim/testdir/test_eval_stuff.vim @@ -21,3 +21,20 @@ func Test_E963() call assert_fails("let v:oldfiles=''", 'E963:') call assert_equal(v_o, v:oldfiles) 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 -- cgit