aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2020-11-03 18:47:32 +0100
committerMichael Albinus2020-11-03 18:47:32 +0100
commit2fffc1dfdff0a37f826a67d90d8a97091207dcb2 (patch)
tree2e914da389f96559132c38a54bca9cb690801c8d /test
parentf9d6e463d310db0e1931f26609d938531c56f9c3 (diff)
downloademacs-2fffc1dfdff0a37f826a67d90d8a97091207dcb2.tar.gz
emacs-2fffc1dfdff0a37f826a67d90d8a97091207dcb2.zip
Some Tramp fixes for directory-files-* and delete-*
* lisp/files.el (delete-directory): Simplify check for trash. * lisp/net/ange-ftp.el (ange-ftp-delete-file): Implement TRASH. * lisp/net/tramp-compat.el (tramp-compat-directory-files) (tramp-compat-directory-files-and-attributes) (tramp-compat-directory-empty-p): New defaliases. * lisp/net/tramp.el (tramp-handle-directory-files-and-attributes) (tramp-skeleton-delete-directory): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-delete-directory): Use them. * lisp/net/tramp-sh.el (tramp-sh-handle-directory-files-and-attributes): Implement COUNT. * test/lisp/net/tramp-tests.el (tramp-test14-delete-directory): Do not run trash test for ange-ftp. (tramp-test16-directory-files) (tramp-test19-directory-files-and-attributes): Check COUNT argument.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 50db55ebb4f..2670723ecdc 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2783,8 +2783,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
2783 (should-not (file-directory-p tmp-name1)) 2783 (should-not (file-directory-p tmp-name1))
2784 2784
2785 ;; Trashing directories works only since Emacs 27.1. It doesn't 2785 ;; Trashing directories works only since Emacs 27.1. It doesn't
2786 ;; work for crypted remote directories. 2786 ;; work for crypted remote directories and for ange-ftp.
2787 (when (and (not (tramp--test-crypt-p)) (tramp--test-emacs27-p)) 2787 (when (and (not (tramp--test-crypt-p)) (not (tramp--test-ftp-p))
2788 (tramp--test-emacs27-p))
2788 (let ((trash-directory (tramp--test-make-temp-name 'local quoted)) 2789 (let ((trash-directory (tramp--test-make-temp-name 'local quoted))
2789 (delete-by-moving-to-trash t)) 2790 (delete-by-moving-to-trash t))
2790 (make-directory trash-directory) 2791 (make-directory trash-directory)
@@ -2925,7 +2926,15 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
2925 '("bla" "foo"))) 2926 '("bla" "foo")))
2926 (should (equal (directory-files 2927 (should (equal (directory-files
2927 tmp-name1 'full directory-files-no-dot-files-regexp) 2928 tmp-name1 'full directory-files-no-dot-files-regexp)
2928 `(,tmp-name2 ,tmp-name3)))) 2929 `(,tmp-name2 ,tmp-name3)))
2930 ;; Check the COUNT arg. It exists since Emacs 28.
2931 (when (tramp--test-emacs28-p)
2932 (with-no-warnings
2933 (should
2934 (= 1 (length
2935 (directory-files
2936 tmp-name1 nil directory-files-no-dot-files-regexp
2937 nil 1)))))))
2929 2938
2930 ;; Cleanup. 2939 ;; Cleanup.
2931 (ignore-errors (delete-directory tmp-name1 'recursive)))))) 2940 (ignore-errors (delete-directory tmp-name1 'recursive))))))
@@ -3443,7 +3452,13 @@ They might differ only in time attributes or directory size."
3443 (file-attributes (car elt)) (cdr elt)))) 3452 (file-attributes (car elt)) (cdr elt))))
3444 3453
3445 (setq attr (directory-files-and-attributes tmp-name2 nil "\\`b")) 3454 (setq attr (directory-files-and-attributes tmp-name2 nil "\\`b"))
3446 (should (equal (mapcar #'car attr) '("bar" "boz")))) 3455 (should (equal (mapcar #'car attr) '("bar" "boz")))
3456
3457 ;; Check the COUNT arg. It exists since Emacs 28.
3458 (when (tramp--test-emacs28-p)
3459 (with-no-warnings
3460 (should (= 1 (length (directory-files-and-attributes
3461 tmp-name2 nil "\\`b" nil nil 1)))))))
3447 3462
3448 ;; Cleanup. 3463 ;; Cleanup.
3449 (ignore-errors (delete-directory tmp-name1 'recursive)))))) 3464 (ignore-errors (delete-directory tmp-name1 'recursive))))))