diff src/testdir/test_edit.vim @ 22490:23a5977d7211 v8.2.1793

patch 8.2.1793: not consistently giving the "is a directory" warning Commit: https://github.com/vim/vim/commit/c8fe645c198e2ca55c4e3446efbbdb9b995c63ce Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 3 17:04:37 2020 +0200 patch 8.2.1793: not consistently giving the "is a directory" warning Problem: Not consistently giving the "is a directory" warning. Solution: Adjust check for illegal file name and directory. (Yasuhiro Matsumoto, closes #7067)
author Bram Moolenaar <Bram@vim.org>
date Sat, 03 Oct 2020 17:15:03 +0200
parents 08940efa6b4e
children 050cff1294ab
line wrap: on
line diff
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -1587,6 +1587,31 @@ func Test_edit_illegal_filename()
   close!
 endfunc
 
+" Test for editing a directory
+func Test_edit_is_a_directory()
+  CheckEnglish
+  let dirname = getcwd() . "/Xdir"
+  call mkdir(dirname, 'p')
+
+  new
+  redir => msg
+  exe 'edit' dirname
+  redir END
+  call assert_match("is a directory$", split(msg, "\n")[0])
+  bwipe!
+
+  let dirname .= '/'
+
+  new
+  redir => msg
+  exe 'edit' dirname
+  redir END
+  call assert_match("is a directory$", split(msg, "\n")[0])
+  bwipe!
+
+  call delete(dirname, 'rf')
+endfunc
+
 " Test for editing a file using invalid file encoding
 func Test_edit_invalid_encoding()
   CheckEnglish