diff options
| author | Michael Albinus | 2019-11-07 12:03:19 +0100 |
|---|---|---|
| committer | Michael Albinus | 2019-11-07 12:03:19 +0100 |
| commit | 4ab780012649bbab60238148efd9d3b4a819fd61 (patch) | |
| tree | dbaed6e41ab712d7f538ddd826d6f68a6d9da1fb /test | |
| parent | ddb797cf4c5f121a5ed003b9746ffaa849d42af5 (diff) | |
| download | emacs-4ab780012649bbab60238148efd9d3b4a819fd61.tar.gz emacs-4ab780012649bbab60238148efd9d3b4a819fd61.zip | |
Make ange-ftp fit for tramp-tests
* lisp/net/ange-ftp.el (ange-ftp-repaint-minibuffer): Use empty message.
(ange-ftp-quote-string): Unquote the string.
(ange-ftp-substitute-in-file-name, ange-ftp-access-file)
(ange-ftp-copy-directory, ange-ftp-make-symbolic-link)
(ange-ftp-add-name-to-file): New defuns. Set 'ange-ftp property.
(ange-ftp-real-substitute-in-file-name)
(ange-ftp-real-copy-directory): New defuns.
(ange-ftp-file-name-as-directory): Care about `non-essential'.
(ange-ftp-file-attributes): Handle ID-STRING.
(ange-ftp-copy-file-internal, ange-ftp-rename-file)
(ange-ftp-make-directory): Improve error handling.
(ange-ftp-insert-directory): Initialize SWITCHES if they are nil.
* test/lisp/net/tramp-tests.el (ange-ftp-make-backup-files): Declare.
(tramp-test39-make-nearby-temp-file, tramp--test-ange-ftp-p): New defun.
(tramp-test05-expand-file-name-relative)
(tramp-test06-directory-file-name, tramp-test10-write-region)
(tramp-test11-copy-file, tramp-test12-rename-file)
(tramp-test17-insert-directory)
(tramp-test26-file-name-completion)
(tramp-test37-make-auto-save-file-name)
(tramp-test38-find-backup-file-name)
(tramp--test-special-characters): Use it.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 283 |
1 files changed, 158 insertions, 125 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 9b73f7ca28e..271ac7299dd 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -57,6 +57,7 @@ | |||
| 57 | (declare-function tramp-method-out-of-band-p "tramp-sh") | 57 | (declare-function tramp-method-out-of-band-p "tramp-sh") |
| 58 | (declare-function tramp-smb-get-localname "tramp-smb") | 58 | (declare-function tramp-smb-get-localname "tramp-smb") |
| 59 | (declare-function tramp-time-diff "tramp") | 59 | (declare-function tramp-time-diff "tramp") |
| 60 | (defvar ange-ftp-make-backup-files) | ||
| 60 | (defvar auto-save-file-name-transforms) | 61 | (defvar auto-save-file-name-transforms) |
| 61 | (defvar tramp-connection-properties) | 62 | (defvar tramp-connection-properties) |
| 62 | (defvar tramp-copy-size-limit) | 63 | (defvar tramp-copy-size-limit) |
| @@ -264,7 +265,7 @@ properly. BODY shall not contain a timeout." | |||
| 264 | ;; No newline or linefeed. | 265 | ;; No newline or linefeed. |
| 265 | (should-not (tramp-tramp-file-p "/method::file\nname")) | 266 | (should-not (tramp-tramp-file-p "/method::file\nname")) |
| 266 | (should-not (tramp-tramp-file-p "/method::file\rname")) | 267 | (should-not (tramp-tramp-file-p "/method::file\rname")) |
| 267 | ;; Ange-ftp syntax. | 268 | ;; Ange-FTP syntax. |
| 268 | (should-not (tramp-tramp-file-p "/host:")) | 269 | (should-not (tramp-tramp-file-p "/host:")) |
| 269 | (should-not (tramp-tramp-file-p "/user@host:")) | 270 | (should-not (tramp-tramp-file-p "/user@host:")) |
| 270 | (should-not (tramp-tramp-file-p "/1.2.3.4:")) | 271 | (should-not (tramp-tramp-file-p "/1.2.3.4:")) |
| @@ -398,7 +399,7 @@ properly. BODY shall not contain a timeout." | |||
| 398 | ;; No strings. | 399 | ;; No strings. |
| 399 | (should-not (tramp-tramp-file-p nil)) | 400 | (should-not (tramp-tramp-file-p nil)) |
| 400 | (should-not (tramp-tramp-file-p 'symbol)) | 401 | (should-not (tramp-tramp-file-p 'symbol)) |
| 401 | ;; Ange-ftp syntax. | 402 | ;; Ange-FTP syntax. |
| 402 | (should-not (tramp-tramp-file-p "/host:")) | 403 | (should-not (tramp-tramp-file-p "/host:")) |
| 403 | (should-not (tramp-tramp-file-p "/user@host:")) | 404 | (should-not (tramp-tramp-file-p "/user@host:")) |
| 404 | (should-not (tramp-tramp-file-p "/1.2.3.4:")) | 405 | (should-not (tramp-tramp-file-p "/1.2.3.4:")) |
| @@ -2065,7 +2066,8 @@ properly. BODY shall not contain a timeout." | |||
| 2065 | (skip-unless (tramp--test-enabled)) | 2066 | (skip-unless (tramp--test-enabled)) |
| 2066 | 2067 | ||
| 2067 | ;; These are the methods the test doesn't fail. | 2068 | ;; These are the methods the test doesn't fail. |
| 2068 | (when (or (tramp--test-adb-p) (tramp--test-gvfs-p) (tramp--test-rclone-p) | 2069 | (when (or (tramp--test-adb-p) (tramp--test-ange-ftp-p) (tramp--test-gvfs-p) |
| 2070 | (tramp--test-rclone-p) | ||
| 2069 | (tramp-smb-file-name-p tramp-test-temporary-file-directory)) | 2071 | (tramp-smb-file-name-p tramp-test-temporary-file-directory)) |
| 2070 | (setf (ert-test-expected-result-type | 2072 | (setf (ert-test-expected-result-type |
| 2071 | (ert-get-test 'tramp-test05-expand-file-name-relative)) | 2073 | (ert-get-test 'tramp-test05-expand-file-name-relative)) |
| @@ -2150,7 +2152,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2150 | (string-equal | 2152 | (string-equal |
| 2151 | (file-name-as-directory file) | 2153 | (file-name-as-directory file) |
| 2152 | (if (tramp-completion-mode-p) | 2154 | (if (tramp-completion-mode-p) |
| 2153 | file (concat file "./")))) | 2155 | file (concat file (if (tramp--test-ange-ftp-p) "/" "./"))))) |
| 2154 | (should (string-equal (file-name-directory file) file)) | 2156 | (should (string-equal (file-name-directory file) file)) |
| 2155 | (should (string-equal (file-name-nondirectory file) ""))))))) | 2157 | (should (string-equal (file-name-nondirectory file) ""))))))) |
| 2156 | 2158 | ||
| @@ -2255,18 +2257,19 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2255 | (should (string-equal (buffer-string) "foo"))) | 2257 | (should (string-equal (buffer-string) "foo"))) |
| 2256 | 2258 | ||
| 2257 | ;; Append. | 2259 | ;; Append. |
| 2258 | (with-temp-buffer | 2260 | (unless (tramp--test-ange-ftp-p) |
| 2259 | (insert "bla") | 2261 | (with-temp-buffer |
| 2260 | (write-region nil nil tmp-name 'append)) | 2262 | (insert "bla") |
| 2261 | (with-temp-buffer | 2263 | (write-region nil nil tmp-name 'append)) |
| 2262 | (insert-file-contents tmp-name) | 2264 | (with-temp-buffer |
| 2263 | (should (string-equal (buffer-string) "foobla"))) | 2265 | (insert-file-contents tmp-name) |
| 2264 | (with-temp-buffer | 2266 | (should (string-equal (buffer-string) "foobla"))) |
| 2265 | (insert "baz") | 2267 | (with-temp-buffer |
| 2266 | (write-region nil nil tmp-name 3)) | 2268 | (insert "baz") |
| 2267 | (with-temp-buffer | 2269 | (write-region nil nil tmp-name 3)) |
| 2268 | (insert-file-contents tmp-name) | 2270 | (with-temp-buffer |
| 2269 | (should (string-equal (buffer-string) "foobaz"))) | 2271 | (insert-file-contents tmp-name) |
| 2272 | (should (string-equal (buffer-string) "foobaz")))) | ||
| 2270 | 2273 | ||
| 2271 | ;; Write string. | 2274 | ;; Write string. |
| 2272 | (write-region "foo" nil tmp-name) | 2275 | (write-region "foo" nil tmp-name) |
| @@ -2286,7 +2289,8 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2286 | ;; Macro `ert-with-message-capture' was introduced in Emacs 26.1. | 2289 | ;; Macro `ert-with-message-capture' was introduced in Emacs 26.1. |
| 2287 | (with-no-warnings (when (symbol-plist 'ert-with-message-capture) | 2290 | (with-no-warnings (when (symbol-plist 'ert-with-message-capture) |
| 2288 | (let ((tramp-message-show-message t)) | 2291 | (let ((tramp-message-show-message t)) |
| 2289 | (dolist (noninteractive '(nil t)) | 2292 | (dolist |
| 2293 | (noninteractive (unless (tramp--test-ange-ftp-p) '(nil t))) | ||
| 2290 | (dolist (visit '(nil t "string" no-message)) | 2294 | (dolist (visit '(nil t "string" no-message)) |
| 2291 | (ert-with-message-capture tramp--test-messages | 2295 | (ert-with-message-capture tramp--test-messages |
| 2292 | (write-region "foo" nil tmp-name nil visit) | 2296 | (write-region "foo" nil tmp-name nil visit) |
| @@ -2300,12 +2304,16 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2300 | tramp--test-messages)))))))) | 2304 | tramp--test-messages)))))))) |
| 2301 | 2305 | ||
| 2302 | ;; Do not overwrite if excluded. | 2306 | ;; Do not overwrite if excluded. |
| 2303 | (cl-letf (((symbol-function 'y-or-n-p) (lambda (_prompt) t))) | 2307 | (cl-letf (((symbol-function 'y-or-n-p) (lambda (_prompt) t)) |
| 2308 | ;; Ange-FTP. | ||
| 2309 | ((symbol-function 'yes-or-no-p) (lambda (_prompt) t))) | ||
| 2304 | (write-region "foo" nil tmp-name nil nil nil 'mustbenew)) | 2310 | (write-region "foo" nil tmp-name nil nil nil 'mustbenew)) |
| 2305 | ;; `mustbenew' is passed to Tramp since Emacs 26.1. | 2311 | ;; `mustbenew' is passed to Tramp since Emacs 26.1. |
| 2306 | (when (tramp--test-emacs26-p) | 2312 | (when (tramp--test-emacs26-p) |
| 2307 | (should-error | 2313 | (should-error |
| 2308 | (cl-letf (((symbol-function 'y-or-n-p) 'ignore)) | 2314 | (cl-letf (((symbol-function 'y-or-n-p) 'ignore) |
| 2315 | ;; Ange-FTP. | ||
| 2316 | ((symbol-function 'yes-or-no-p) 'ignore)) | ||
| 2309 | (write-region "foo" nil tmp-name nil nil nil 'mustbenew)) | 2317 | (write-region "foo" nil tmp-name nil nil nil 'mustbenew)) |
| 2310 | :type 'file-already-exists) | 2318 | :type 'file-already-exists) |
| 2311 | (should-error | 2319 | (should-error |
| @@ -2394,7 +2402,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2394 | (unwind-protect | 2402 | (unwind-protect |
| 2395 | ;; FIXME: This fails on my QNAP server, see | 2403 | ;; FIXME: This fails on my QNAP server, see |
| 2396 | ;; /share/Web/owncloud/data/owncloud.log | 2404 | ;; /share/Web/owncloud/data/owncloud.log |
| 2397 | (unless (tramp--test-nextcloud-p) | 2405 | (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p)) |
| 2398 | (write-region "foo" nil source) | 2406 | (write-region "foo" nil source) |
| 2399 | (should (file-exists-p source)) | 2407 | (should (file-exists-p source)) |
| 2400 | (make-directory target) | 2408 | (make-directory target) |
| @@ -2420,7 +2428,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2420 | (unwind-protect | 2428 | (unwind-protect |
| 2421 | ;; FIXME: This fails on my QNAP server, see | 2429 | ;; FIXME: This fails on my QNAP server, see |
| 2422 | ;; /share/Web/owncloud/data/owncloud.log | 2430 | ;; /share/Web/owncloud/data/owncloud.log |
| 2423 | (unless (tramp--test-nextcloud-p) | 2431 | (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p)) |
| 2424 | (make-directory source) | 2432 | (make-directory source) |
| 2425 | (should (file-directory-p source)) | 2433 | (should (file-directory-p source)) |
| 2426 | (write-region "foo" nil (expand-file-name "foo" source)) | 2434 | (write-region "foo" nil (expand-file-name "foo" source)) |
| @@ -2443,7 +2451,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2443 | (unwind-protect | 2451 | (unwind-protect |
| 2444 | ;; FIXME: This fails on my QNAP server, see | 2452 | ;; FIXME: This fails on my QNAP server, see |
| 2445 | ;; /share/Web/owncloud/data/owncloud.log | 2453 | ;; /share/Web/owncloud/data/owncloud.log |
| 2446 | (unless (tramp--test-nextcloud-p) | 2454 | (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p)) |
| 2447 | (make-directory source) | 2455 | (make-directory source) |
| 2448 | (should (file-directory-p source)) | 2456 | (should (file-directory-p source)) |
| 2449 | (write-region "foo" nil (expand-file-name "foo" source)) | 2457 | (write-region "foo" nil (expand-file-name "foo" source)) |
| @@ -2538,7 +2546,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2538 | (unwind-protect | 2546 | (unwind-protect |
| 2539 | ;; FIXME: This fails on my QNAP server, see | 2547 | ;; FIXME: This fails on my QNAP server, see |
| 2540 | ;; /share/Web/owncloud/data/owncloud.log | 2548 | ;; /share/Web/owncloud/data/owncloud.log |
| 2541 | (unless (tramp--test-nextcloud-p) | 2549 | (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p)) |
| 2542 | (make-directory source) | 2550 | (make-directory source) |
| 2543 | (should (file-directory-p source)) | 2551 | (should (file-directory-p source)) |
| 2544 | (write-region "foo" nil (expand-file-name "foo" source)) | 2552 | (write-region "foo" nil (expand-file-name "foo" source)) |
| @@ -2562,7 +2570,7 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2562 | (unwind-protect | 2570 | (unwind-protect |
| 2563 | ;; FIXME: This fails on my QNAP server, see | 2571 | ;; FIXME: This fails on my QNAP server, see |
| 2564 | ;; /share/Web/owncloud/data/owncloud.log | 2572 | ;; /share/Web/owncloud/data/owncloud.log |
| 2565 | (unless (tramp--test-nextcloud-p) | 2573 | (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p)) |
| 2566 | (make-directory source) | 2574 | (make-directory source) |
| 2567 | (should (file-directory-p source)) | 2575 | (should (file-directory-p source)) |
| 2568 | (write-region "foo" nil (expand-file-name "foo" source)) | 2576 | (write-region "foo" nil (expand-file-name "foo" source)) |
| @@ -2810,6 +2818,10 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 2810 | (ert-deftest tramp-test17-insert-directory () | 2818 | (ert-deftest tramp-test17-insert-directory () |
| 2811 | "Check `insert-directory'." | 2819 | "Check `insert-directory'." |
| 2812 | (skip-unless (tramp--test-enabled)) | 2820 | (skip-unless (tramp--test-enabled)) |
| 2821 | ;; Ange-FTP is very special. It does not include the header line | ||
| 2822 | ;; (this is performed by `dired'). If FULL is nil, it shows just | ||
| 2823 | ;; one file. So we refrain from testing. | ||
| 2824 | (skip-unless (not (tramp--test-ange-ftp-p))) | ||
| 2813 | 2825 | ||
| 2814 | (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) | 2826 | (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) |
| 2815 | (let* ((tmp-name1 | 2827 | (let* ((tmp-name1 |
| @@ -3928,9 +3940,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3928 | (should (equal (file-name-completion "foo" tmp-name) t)) | 3940 | (should (equal (file-name-completion "foo" tmp-name) t)) |
| 3929 | (should (equal (file-name-completion "b" tmp-name) "bo")) | 3941 | (should (equal (file-name-completion "b" tmp-name) "bo")) |
| 3930 | (should-not (file-name-completion "a" tmp-name)) | 3942 | (should-not (file-name-completion "a" tmp-name)) |
| 3931 | (should | 3943 | ;; Ange-FTP does not support predicates. |
| 3932 | (equal | 3944 | (unless (tramp--test-ange-ftp-p) |
| 3933 | (file-name-completion "b" tmp-name #'file-directory-p) "boz/")) | 3945 | (should |
| 3946 | (equal | ||
| 3947 | (file-name-completion "b" tmp-name #'file-directory-p) | ||
| 3948 | "boz/"))) | ||
| 3934 | (should | 3949 | (should |
| 3935 | (equal (file-name-all-completions "fo" tmp-name) '("foo"))) | 3950 | (equal (file-name-all-completions "fo" tmp-name) '("foo"))) |
| 3936 | (should | 3951 | (should |
| @@ -3940,14 +3955,17 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3940 | (should-not (file-name-all-completions "a" tmp-name)) | 3955 | (should-not (file-name-all-completions "a" tmp-name)) |
| 3941 | ;; `completion-regexp-list' restricts the completion to | 3956 | ;; `completion-regexp-list' restricts the completion to |
| 3942 | ;; files which match all expressions in this list. | 3957 | ;; files which match all expressions in this list. |
| 3943 | (let ((completion-regexp-list | 3958 | ;; Ange-FTP does not complete "". |
| 3944 | `(,directory-files-no-dot-files-regexp "b"))) | 3959 | (unless (tramp--test-ange-ftp-p) |
| 3945 | (should | 3960 | (let ((completion-regexp-list |
| 3946 | (equal (file-name-completion "" tmp-name) "bo")) | 3961 | `(,directory-files-no-dot-files-regexp "b"))) |
| 3947 | (should | 3962 | (should |
| 3948 | (equal | 3963 | (equal (file-name-completion "" tmp-name) "bo")) |
| 3949 | (sort (file-name-all-completions "" tmp-name) #'string-lessp) | 3964 | (should |
| 3950 | '("bold" "boz/")))) | 3965 | (equal |
| 3966 | (sort | ||
| 3967 | (file-name-all-completions "" tmp-name) #'string-lessp) | ||
| 3968 | '("bold" "boz/"))))) | ||
| 3951 | ;; `file-name-completion' ignores file names that end in | 3969 | ;; `file-name-completion' ignores file names that end in |
| 3952 | ;; any string in `completion-ignored-extensions'. | 3970 | ;; any string in `completion-ignored-extensions'. |
| 3953 | (let ((completion-ignored-extensions '(".ext"))) | 3971 | (let ((completion-ignored-extensions '(".ext"))) |
| @@ -4881,49 +4899,52 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4881 | tramp-test-temporary-file-directory)))))) | 4899 | tramp-test-temporary-file-directory)))))) |
| 4882 | 4900 | ||
| 4883 | ;; Use default `tramp-auto-save-directory' mechanism. | 4901 | ;; Use default `tramp-auto-save-directory' mechanism. |
| 4884 | (let ((tramp-auto-save-directory tmp-name2)) | 4902 | ;; Ange-FTP doesn't care. |
| 4885 | (with-temp-buffer | 4903 | (unless (tramp--test-ange-ftp-p) |
| 4886 | (setq buffer-file-name tmp-name1) | 4904 | (let ((tramp-auto-save-directory tmp-name2)) |
| 4887 | (should | 4905 | (with-temp-buffer |
| 4888 | (string-equal | 4906 | (setq buffer-file-name tmp-name1) |
| 4889 | (make-auto-save-file-name) | 4907 | (should |
| 4890 | ;; This is taken from Tramp. | 4908 | (string-equal |
| 4891 | (expand-file-name | 4909 | (make-auto-save-file-name) |
| 4892 | (format | 4910 | ;; This is taken from Tramp. |
| 4893 | "#%s#" | 4911 | (expand-file-name |
| 4894 | (tramp-subst-strs-in-string | 4912 | (format |
| 4895 | '(("_" . "|") | 4913 | "#%s#" |
| 4896 | ("/" . "_a") | 4914 | (tramp-subst-strs-in-string |
| 4897 | (":" . "_b") | 4915 | '(("_" . "|") |
| 4898 | ("|" . "__") | 4916 | ("/" . "_a") |
| 4899 | ("[" . "_l") | 4917 | (":" . "_b") |
| 4900 | ("]" . "_r")) | 4918 | ("|" . "__") |
| 4901 | (tramp-compat-file-name-unquote tmp-name1))) | 4919 | ("[" . "_l") |
| 4902 | tmp-name2))) | 4920 | ("]" . "_r")) |
| 4903 | (should (file-directory-p tmp-name2)))) | 4921 | (tramp-compat-file-name-unquote tmp-name1))) |
| 4904 | 4922 | tmp-name2))) | |
| 4905 | ;; Relative file names shall work, too. | 4923 | (should (file-directory-p tmp-name2))))) |
| 4906 | (let ((tramp-auto-save-directory ".")) | 4924 | |
| 4907 | (with-temp-buffer | 4925 | ;; Relative file names shall work, too. Ange-FTP doesn't care. |
| 4908 | (setq buffer-file-name tmp-name1 | 4926 | (unless (tramp--test-ange-ftp-p) |
| 4909 | default-directory tmp-name2) | 4927 | (let ((tramp-auto-save-directory ".")) |
| 4910 | (should | 4928 | (with-temp-buffer |
| 4911 | (string-equal | 4929 | (setq buffer-file-name tmp-name1 |
| 4912 | (make-auto-save-file-name) | 4930 | default-directory tmp-name2) |
| 4913 | ;; This is taken from Tramp. | 4931 | (should |
| 4914 | (expand-file-name | 4932 | (string-equal |
| 4915 | (format | 4933 | (make-auto-save-file-name) |
| 4916 | "#%s#" | 4934 | ;; This is taken from Tramp. |
| 4917 | (tramp-subst-strs-in-string | 4935 | (expand-file-name |
| 4918 | '(("_" . "|") | 4936 | (format |
| 4919 | ("/" . "_a") | 4937 | "#%s#" |
| 4920 | (":" . "_b") | 4938 | (tramp-subst-strs-in-string |
| 4921 | ("|" . "__") | 4939 | '(("_" . "|") |
| 4922 | ("[" . "_l") | 4940 | ("/" . "_a") |
| 4923 | ("]" . "_r")) | 4941 | (":" . "_b") |
| 4924 | (tramp-compat-file-name-unquote tmp-name1))) | 4942 | ("|" . "__") |
| 4925 | tmp-name2))) | 4943 | ("[" . "_l") |
| 4926 | (should (file-directory-p tmp-name2))))) | 4944 | ("]" . "_r")) |
| 4945 | (tramp-compat-file-name-unquote tmp-name1))) | ||
| 4946 | tmp-name2))) | ||
| 4947 | (should (file-directory-p tmp-name2)))))) | ||
| 4927 | 4948 | ||
| 4928 | ;; Cleanup. | 4949 | ;; Cleanup. |
| 4929 | (ignore-errors (delete-file tmp-name1)) | 4950 | (ignore-errors (delete-file tmp-name1)) |
| @@ -4936,6 +4957,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4936 | (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) | 4957 | (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) |
| 4937 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) | 4958 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) |
| 4938 | (tmp-name2 (tramp--test-make-temp-name nil quoted)) | 4959 | (tmp-name2 (tramp--test-make-temp-name nil quoted)) |
| 4960 | (ange-ftp-make-backup-files t) | ||
| 4939 | ;; These settings are not used by Tramp, so we ignore them. | 4961 | ;; These settings are not used by Tramp, so we ignore them. |
| 4940 | version-control delete-old-versions | 4962 | version-control delete-old-versions |
| 4941 | (kept-old-versions (default-toplevel-value 'kept-old-versions)) | 4963 | (kept-old-versions (default-toplevel-value 'kept-old-versions)) |
| @@ -4983,58 +5005,61 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4983 | (ignore-errors (delete-directory tmp-name2 'recursive))) | 5005 | (ignore-errors (delete-directory tmp-name2 'recursive))) |
| 4984 | 5006 | ||
| 4985 | (unwind-protect | 5007 | (unwind-protect |
| 4986 | ;; Map `tramp-backup-directory-alist'. | 5008 | ;; Map `tramp-backup-directory-alist'. Ange-FTP doesn't care. |
| 4987 | (let ((tramp-backup-directory-alist `(("." . ,tmp-name2))) | 5009 | (unless (tramp--test-ange-ftp-p) |
| 4988 | backup-directory-alist) | 5010 | (let ((tramp-backup-directory-alist `(("." . ,tmp-name2))) |
| 4989 | (should | 5011 | backup-directory-alist) |
| 4990 | (equal | 5012 | (should |
| 4991 | (find-backup-file-name tmp-name1) | 5013 | (equal |
| 4992 | (list | 5014 | (find-backup-file-name tmp-name1) |
| 4993 | (funcall | 5015 | (list |
| 4994 | (if quoted #'tramp-compat-file-name-quote #'identity) | 5016 | (funcall |
| 4995 | (expand-file-name | 5017 | (if quoted #'tramp-compat-file-name-quote #'identity) |
| 4996 | (format | 5018 | (expand-file-name |
| 4997 | "%s~" | 5019 | (format |
| 4998 | ;; This is taken from `make-backup-file-name-1'. We | 5020 | "%s~" |
| 4999 | ;; call `convert-standard-filename', because on MS | 5021 | ;; This is taken from `make-backup-file-name-1'. |
| 5000 | ;; Windows the (local) colons must be replaced by | 5022 | ;; We call `convert-standard-filename', because on |
| 5001 | ;; exclamation marks. | 5023 | ;; MS Windows the (local) colons must be replaced |
| 5002 | (subst-char-in-string | 5024 | ;; by exclamation marks. |
| 5003 | ?/ ?! | 5025 | (subst-char-in-string |
| 5004 | (replace-regexp-in-string | 5026 | ?/ ?! |
| 5005 | "!" "!!" (convert-standard-filename tmp-name1)))) | 5027 | (replace-regexp-in-string |
| 5006 | tmp-name2))))) | 5028 | "!" "!!" (convert-standard-filename tmp-name1)))) |
| 5007 | ;; The backup directory is created. | 5029 | tmp-name2))))) |
| 5008 | (should (file-directory-p tmp-name2))) | 5030 | ;; The backup directory is created. |
| 5031 | (should (file-directory-p tmp-name2)))) | ||
| 5009 | 5032 | ||
| 5010 | ;; Cleanup. | 5033 | ;; Cleanup. |
| 5011 | (ignore-errors (delete-directory tmp-name2 'recursive))) | 5034 | (ignore-errors (delete-directory tmp-name2 'recursive))) |
| 5012 | 5035 | ||
| 5013 | (unwind-protect | 5036 | (unwind-protect |
| 5014 | ;; Map `tramp-backup-directory-alist' with local file name. | 5037 | ;; Map `tramp-backup-directory-alist' with local file name. |
| 5015 | (let ((tramp-backup-directory-alist | 5038 | ;; Ange-FTP doesn't care. |
| 5016 | `(("." . ,(file-remote-p tmp-name2 'localname)))) | 5039 | (unless (tramp--test-ange-ftp-p) |
| 5017 | backup-directory-alist) | 5040 | (let ((tramp-backup-directory-alist |
| 5018 | (should | 5041 | `(("." . ,(file-remote-p tmp-name2 'localname)))) |
| 5019 | (equal | 5042 | backup-directory-alist) |
| 5020 | (find-backup-file-name tmp-name1) | 5043 | (should |
| 5021 | (list | 5044 | (equal |
| 5022 | (funcall | 5045 | (find-backup-file-name tmp-name1) |
| 5023 | (if quoted #'tramp-compat-file-name-quote #'identity) | 5046 | (list |
| 5024 | (expand-file-name | 5047 | (funcall |
| 5025 | (format | 5048 | (if quoted #'tramp-compat-file-name-quote #'identity) |
| 5026 | "%s~" | 5049 | (expand-file-name |
| 5027 | ;; This is taken from `make-backup-file-name-1'. We | 5050 | (format |
| 5028 | ;; call `convert-standard-filename', because on MS | 5051 | "%s~" |
| 5029 | ;; Windows the (local) colons must be replaced by | 5052 | ;; This is taken from `make-backup-file-name-1'. |
| 5030 | ;; exclamation marks. | 5053 | ;; We call `convert-standard-filename', because on |
| 5031 | (subst-char-in-string | 5054 | ;; MS Windows the (local) colons must be replaced |
| 5032 | ?/ ?! | 5055 | ;; by exclamation marks. |
| 5033 | (replace-regexp-in-string | 5056 | (subst-char-in-string |
| 5034 | "!" "!!" (convert-standard-filename tmp-name1)))) | 5057 | ?/ ?! |
| 5035 | tmp-name2))))) | 5058 | (replace-regexp-in-string |
| 5036 | ;; The backup directory is created. | 5059 | "!" "!!" (convert-standard-filename tmp-name1)))) |
| 5037 | (should (file-directory-p tmp-name2))) | 5060 | tmp-name2))))) |
| 5061 | ;; The backup directory is created. | ||
| 5062 | (should (file-directory-p tmp-name2)))) | ||
| 5038 | 5063 | ||
| 5039 | ;; Cleanup. | 5064 | ;; Cleanup. |
| 5040 | (ignore-errors (delete-directory tmp-name2 'recursive)))))) | 5065 | (ignore-errors (delete-directory tmp-name2 'recursive)))))) |
| @@ -5043,6 +5068,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 5043 | (ert-deftest tramp-test39-make-nearby-temp-file () | 5068 | (ert-deftest tramp-test39-make-nearby-temp-file () |
| 5044 | "Check `make-nearby-temp-file' and `temporary-file-directory'." | 5069 | "Check `make-nearby-temp-file' and `temporary-file-directory'." |
| 5045 | (skip-unless (tramp--test-enabled)) | 5070 | (skip-unless (tramp--test-enabled)) |
| 5071 | (skip-unless (not (tramp--test-ange-ftp-p))) | ||
| 5046 | ;; Since Emacs 26.1. | 5072 | ;; Since Emacs 26.1. |
| 5047 | (skip-unless | 5073 | (skip-unless |
| 5048 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) | 5074 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) |
| @@ -5099,6 +5125,12 @@ variables, so we check the Emacs version directly." | |||
| 5099 | This requires restrictions of file name syntax." | 5125 | This requires restrictions of file name syntax." |
| 5100 | (tramp-adb-file-name-p tramp-test-temporary-file-directory)) | 5126 | (tramp-adb-file-name-p tramp-test-temporary-file-directory)) |
| 5101 | 5127 | ||
| 5128 | (defun tramp--test-ange-ftp-p () | ||
| 5129 | "Check, whether Ange-FTP is used." | ||
| 5130 | (eq | ||
| 5131 | (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) | ||
| 5132 | 'tramp-ftp-file-name-handler)) | ||
| 5133 | |||
| 5102 | (defun tramp--test-docker-p () | 5134 | (defun tramp--test-docker-p () |
| 5103 | "Check, whether the docker method is used. | 5135 | "Check, whether the docker method is used. |
| 5104 | This does not support some special file names." | 5136 | This does not support some special file names." |
| @@ -5373,7 +5405,8 @@ This requires restrictions of file name syntax." | |||
| 5373 | ;; expanded to <TAB>. | 5405 | ;; expanded to <TAB>. |
| 5374 | (let ((files | 5406 | (let ((files |
| 5375 | (list | 5407 | (list |
| 5376 | (if (or (tramp--test-gvfs-p) | 5408 | (if (or (tramp--test-ange-ftp-p) |
| 5409 | (tramp--test-gvfs-p) | ||
| 5377 | (tramp--test-rclone-p) | 5410 | (tramp--test-rclone-p) |
| 5378 | (tramp--test-sudoedit-p) | 5411 | (tramp--test-sudoedit-p) |
| 5379 | (tramp--test-windows-nt-or-smb-p)) | 5412 | (tramp--test-windows-nt-or-smb-p)) |