Mercurial > vim
diff src/testdir/test_terminal.vim @ 14948:cb07193c6257 v8.1.0485
patch 8.1.0485: term_start() does not check if directory is accessible
commit https://github.com/vim/vim/commit/839e81e12d81377f74ffc03f8645ce52cbc18b13
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Oct 19 16:53:39 2018 +0200
patch 8.1.0485: term_start() does not check if directory is accessible
Problem: term_start() does not check if directory is accessible.
Solution: Add mch_access() call. (Jason Franklin)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 19 Oct 2018 17:00:06 +0200 |
parents | ecf6c05d8ac3 |
children | bc0f3c4fb992 |
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -478,6 +478,28 @@ func Test_terminal_cwd() call delete('Xdir', 'rf') endfunc +func Test_terminal_cwd_failure() + " Case 1: Provided directory is not actually a directory. Attempt to make + " the file executable as well. + call writefile([], 'Xfile') + call setfperm('Xfile', 'rwx------') + call assert_fails("call term_start(&shell, {'cwd': 'Xfile'})", 'E475:') + call delete('Xfile') + + " Case 2: Directory does not exist. + call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:') + + " Case 3: Directory exists but is not accessible. + call mkdir('Xdir', '', '0600') + " return early if the directory permissions could not be set properly + if getfperm('Xdir')[2] == 'x' + call delete('Xdir', 'rf') + return + endif + call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:') + call delete('Xdir', 'rf') +endfunc + func Test_terminal_servername() if !has('clientserver') return