]> granicus.if.org Git - vim/commitdiff
patch 8.2.3136: no test for E187 and "No swap file" v8.2.3136
authorDominique Pelle <dominique.pelle@gmail.com>
Sat, 10 Jul 2021 15:59:48 +0000 (17:59 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 10 Jul 2021 15:59:48 +0000 (17:59 +0200)
Problem:    No test for E187 and "No swap file".
Solution:   Add a test. (Dominique PellĂ©, closes #8540)

src/testdir/test_cd.vim
src/testdir/test_swap.vim
src/version.c

index 0899bcde624e6d0cafaf7da33db00a56a91db8aa..8eda44aff265761ab506a4303e643d6b004ac952 100644 (file)
@@ -1,6 +1,7 @@
 " 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.
@@ -177,6 +178,21 @@ func Test_lcd_split()
   quit!
 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
+
 func Test_cd_completion()
   call mkdir('XComplDir1', 'p')
   call mkdir('XComplDir2', 'p')
index e62412b10cad3d6927760c2657aac3875b11c832..72d204ae013d6c37665f7af6c2c2bc18e20066c8 100644 (file)
@@ -574,4 +574,8 @@ func Test_swapchoice()
   augroup! test_swapchoice
 endfunc
 
+func Test_no_swap_file()
+  call assert_equal("\nNo swap file", execute('swapname'))
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 0a53ab9356e5bb1db7904fd49e038f92f9036e2e..bcbff0a9cb437b0cd8cc8cef42306789b06ef146 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3136,
 /**/
     3135,
 /**/