From 927383f212bfecd224e9071da363c17655a3e415 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 31 Jul 2021 18:28:36 -0400 Subject: vim-patch:8.2.3136: no test for E187 and "No swap file" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: No test for E187 and "No swap file". Solution: Add a test. (Dominique Pellé, closes vim/vim#8540) https://github.com/vim/vim/commit/fe3418abe0dac65e42e85b5a91c5d0c975bc65bb --- src/nvim/testdir/test_cd.vim | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir/test_cd.vim') diff --git a/src/nvim/testdir/test_cd.vim b/src/nvim/testdir/test_cd.vim index 770ed55b8d..02a23bf82f 100644 --- a/src/nvim/testdir/test_cd.vim +++ b/src/nvim/testdir/test_cd.vim @@ -1,4 +1,7 @@ -" Test for :cd +" Test for :cd and chdir() + +source shared.vim +source check.vim func Test_cd_large_path() " This used to crash with a heap write overflow. @@ -65,3 +68,18 @@ func Test_cd_with_cpo_chdir() set cpo& bw! endfunc + +func Test_cd_from_non_existing_dir() + CheckNotMSWindows + + let saveddir = getcwd() + call mkdir('Xdeleted_dir') + cd Xdeleted_dir + call delete(saveddir .. '/Xdeleted_dir', 'd') + + " Expect E187 as the current directory was deleted. + call assert_fails('pwd', 'E187:') + call assert_equal('', getcwd()) + cd - + call assert_equal(saveddir, getcwd()) +endfunc -- cgit