diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2019-11-04 17:34:31 +0100 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2019-11-04 17:34:31 +0100 |
commit | dd19cc3aa16ccc441a8a2bfcdeb3005a6eef2543 (patch) | |
tree | 42bd79ad2020a595244d981f0598b6e4595191bc /test/lisp/net/tramp-tests.el | |
parent | a256e03bd944384efb3da05858264a5d3b72462d (diff) | |
download | emacs-dd19cc3aa16ccc441a8a2bfcdeb3005a6eef2543.tar.gz |
Improve Tramp error handling
* lisp/net/tramp.el (tramp-set-syntax): Add missing argument.
(tramp-signal-hook-function): Make it more robust.
(tramp-handle-directory-files):
* lisp/net/tramp-adb.el
(tramp-adb-handle-directory-files-and-attributes)
(tramp-adb-handle-copy-file, tramp-adb-handle-rename-file):
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file):
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file)
(tramp-rclone-handle-directory-files):
* lisp/net/tramp-sh.el (tramp-sh-handle-directory-files-and-attributes)
(tramp-sh-handle-copy-directory, tramp-do-copy-or-rename-file):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-copy-file, tramp-smb-handle-directory-files)
(tramp-smb-handle-rename-file):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file):
Improve error handling.
* test/lisp/net/tramp-tests.el (tramp-test11-copy-file)
(tramp-test12-rename-file, tramp-test14-delete-directory)
(tramp-test15-copy-directory, tramp-test16-directory-files)
(tramp-test19-directory-files-and-attributes): Extend tests.
Diffstat (limited to 'test/lisp/net/tramp-tests.el')
-rw-r--r-- | test/lisp/net/tramp-tests.el | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index baebae17e1f..ec9cda0bbdd 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -2370,6 +2370,9 @@ This checks also `file-name-as-directory', `file-name-directory', ;; Copy simple file. (unwind-protect (progn + (should-error + (copy-file source target) + :type tramp-file-missing) (write-region "foo" nil source) (should (file-exists-p source)) (copy-file source target) @@ -2482,6 +2485,9 @@ This checks also `file-name-as-directory', `file-name-directory', ;; Rename simple file. (unwind-protect (progn + (should-error + (rename-file source target) + :type tramp-file-missing) (write-region "foo" nil source) (should (file-exists-p source)) (rename-file source target) @@ -2605,20 +2611,25 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (skip-unless (tramp--test-enabled)) (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) - (let ((tmp-name (tramp--test-make-temp-name nil quoted))) + (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (expand-file-name "foo" tmp-name1))) ;; Delete empty directory. - (make-directory tmp-name) - (should (file-directory-p tmp-name)) - (delete-directory tmp-name) - (should-not (file-directory-p tmp-name)) + (make-directory tmp-name1) + (should (file-directory-p tmp-name1)) + (delete-directory tmp-name1) + (should-not (file-directory-p tmp-name1)) ;; Delete non-empty directory. - (make-directory tmp-name) - (should (file-directory-p tmp-name)) - (write-region "foo" nil (expand-file-name "bla" tmp-name)) - (should (file-exists-p (expand-file-name "bla" tmp-name))) - (should-error (delete-directory tmp-name) :type 'file-error) - (delete-directory tmp-name 'recursive) - (should-not (file-directory-p tmp-name))))) + (make-directory tmp-name1) + (should (file-directory-p tmp-name1)) + (write-region "foo" nil (expand-file-name "bla" tmp-name1)) + (should (file-exists-p (expand-file-name "bla" tmp-name1))) + (make-directory tmp-name2) + (should (file-directory-p tmp-name2)) + (write-region "foo" nil (expand-file-name "bla" tmp-name2)) + (should (file-exists-p (expand-file-name "bla" tmp-name2))) + (should-error (delete-directory tmp-name1) :type 'file-error) + (delete-directory tmp-name1 'recursive) + (should-not (file-directory-p tmp-name1))))) (ert-deftest tramp-test15-copy-directory () "Check `copy-directory'." @@ -2636,6 +2647,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." ;; Copy complete directory. (unwind-protect (progn + (should-error + (copy-directory tmp-name1 tmp-name2) + :type tramp-file-missing) ;; Copy empty directory. (make-directory tmp-name1) (write-region "foo" nil tmp-name4) @@ -2696,6 +2710,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (tmp-name3 (expand-file-name "foo" tmp-name1))) (unwind-protect (progn + (should-error + (directory-files tmp-name1) + :type tramp-file-missing) (make-directory tmp-name1) (write-region "foo" nil tmp-name2) (write-region "bla" nil tmp-name3) @@ -3174,6 +3191,9 @@ They might differ only in time attributes or directory size." attr) (unwind-protect (progn + (should-error + (directory-files-and-attributes tmp-name1) + :type tramp-file-missing) (make-directory tmp-name1) (should (file-directory-p tmp-name1)) (setq tramp--test-start-time |