diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2019-02-19 14:00:17 +0100 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2019-02-19 14:00:17 +0100 |
commit | 0a6c4479cff17b487580abe3a7ee202e71be25d2 (patch) | |
tree | 8a24cd4d5742520afb9ef949da2b3f60eaf84d13 /test/lisp/net/tramp-archive-tests.el | |
parent | e8b6cc9a99374b135a3a71dabefcdf98fe2bc6e6 (diff) | |
download | emacs-0a6c4479cff17b487580abe3a7ee202e71be25d2.tar.gz |
Implement access-file in Tramp
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist)
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Add `access-file'.
* lisp/net/tramp-archive.el (tramp-archive-handle-access-file):
* lisp/net/tramp.el (tramp-handle-access-file): New defun.
(tramp-condition-case-unless-debug): Add declaration.
(tramp-handle-insert-directory):
* lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory):
* lisp/net/tramp-smb.el (tramp-smb-handle-insert-directory):
Check, whether directory is accessible.
* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test17-insert-directory)
(tramp-archive-test18-file-attributes):
* test/lisp/net/tramp-tests.el (tramp-test17-insert-directory)
(tramp-test18-file-attributes): Test error cases.
Diffstat (limited to 'test/lisp/net/tramp-archive-tests.el')
-rw-r--r-- | test/lisp/net/tramp-archive-tests.el | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el index 1d9de39ae96..9f06ab1000c 100644 --- a/test/lisp/net/tramp-archive-tests.el +++ b/test/lisp/net/tramp-archive-tests.el @@ -570,26 +570,35 @@ This checks also `file-name-as-directory', `file-name-directory', (format "\\(.+ %s\\( ->.+\\)?\n\\)\\{%d\\}" (regexp-opt (directory-files tramp-archive-test-archive)) - (length (directory-files tramp-archive-test-archive)))))))) + (length (directory-files tramp-archive-test-archive))))))) + + ;; Check error case. + (with-temp-buffer + (should-error + (insert-directory + (expand-file-name "baz" tramp-archive-test-archive) nil) + :type tramp-file-missing))) ;; Cleanup. (tramp-archive-cleanup-hash)))) (ert-deftest tramp-archive-test18-file-attributes () "Check `file-attributes'. -This tests also `file-readable-p' and `file-regular-p'." +This tests also `access-file', `file-readable-p' and `file-regular-p'." :tags '(:expensive-test) (skip-unless tramp-archive-enabled) (let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive)) (tmp-name2 (expand-file-name "foo.lnk" tramp-archive-test-archive)) (tmp-name3 (expand-file-name "bar" tramp-archive-test-archive)) + (tmp-name4 (expand-file-name "baz" tramp-archive-test-archive)) attr) (unwind-protect (progn (should (file-exists-p tmp-name1)) (should (file-readable-p tmp-name1)) (should (file-regular-p tmp-name1)) + (should-not (access-file tmp-name1 "error")) ;; We do not test inodes and device numbers. (setq attr (file-attributes tmp-name1)) @@ -622,7 +631,13 @@ This tests also `file-readable-p' and `file-regular-p'." (should (file-readable-p tmp-name3)) (should-not (file-regular-p tmp-name3)) (setq attr (file-attributes tmp-name3)) - (should (eq (car attr) t))) + (should (eq (car attr) t)) + (should-not (access-file tmp-name3 "error")) + + ;; Check error case. + (should-error + (access-file tmp-name4 "error") + :type tramp-file-missing)) ;; Cleanup. (tramp-archive-cleanup-hash)))) |