aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_cd.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/testdir/test_cd.vim')
-rw-r--r--src/nvim/testdir/test_cd.vim20
1 files changed, 19 insertions, 1 deletions
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