diff options
| author | Michael Albinus | 2023-01-15 17:50:17 +0100 |
|---|---|---|
| committer | Michael Albinus | 2023-01-15 17:50:17 +0100 |
| commit | ead86da14bffe1ce7471745bc9f443b7001f362a (patch) | |
| tree | 428885fb944e9af8485ae301976be0b1f3be5867 /test | |
| parent | 77ca6aa56e3425c87861cab8abce52bee3697cf4 (diff) | |
| download | emacs-ead86da14bffe1ce7471745bc9f443b7001f362a.tar.gz emacs-ead86da14bffe1ce7471745bc9f443b7001f362a.zip | |
Upgrade to length* functions in Tramp
* lisp/net/tramp-compat.el (tramp-compat-replace-regexp-in-region):
Move up.
(tramp-compat-length<, tramp-compat-length>)
(tramp-compat-length=): New defaliases.
(tramp-compat-file-name-unquote, tramp-compat-take)
(tramp-compat-ntake): Use them.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
(tramp-find-host, tramp-buffer-name, tramp-make-tramp-file-name)
(tramp-completion-make-tramp-file-name, tramp-debug-buffer-name)
(tramp-completion-handle-file-name-all-completions)
(tramp-handle-directory-file-name)
(tramp-handle-expand-file-name)
(tramp-handle-file-name-as-directory)
(tramp-handle-file-name-completion)
(tramp-direct-async-process-p, tramp-call-process)
(tramp-read-passwd):
* lisp/net/tramp-adb.el (tramp-adb-get-device)
(tramp-adb-execute-adb-command, tramp-adb-maybe-open-connection):
* lisp/net/tramp-archive.el (tramp-archive-handle-directory-file-name):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-handle-get-home-directory)
(tramp-gvfs-handler-askpassword)
(tramp-gvfs-maybe-open-connection, tramp-get-media-devices):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-directory-p)
(tramp-sh-handle-insert-directory)
(tramp-sh-handle-expand-file-name, tramp-sh-handle-make-process)
(tramp-sh-gio-monitor-process-filter, tramp-set-remote-path)
(tramp-open-connection-setup-interactive-shell)
(tramp-maybe-open-connection, tramp-make-copy-program-file-name):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-expand-file-name, tramp-smb-handle-file-acl)
(tramp-smb-handle-insert-directory)
(tramp-smb-handle-set-file-acl)
(tramp-smb-handle-get-home-directory)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-expand-file-name)
(tramp-sudoedit-handle-file-name-all-completions): Use the new
functions.
* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test43-file-system-info):
* test/lisp/net/tramp-tests.el (tramp-test26-file-name-completion)
(tramp-test31-memory-info, tramp-test35-remote-path)
(tramp-test43-file-system-info): Use new compat functions.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-archive-tests.el | 2 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 24 |
2 files changed, 14 insertions, 12 deletions
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el index 85766f95cda..59b7ed9cf7c 100644 --- a/test/lisp/net/tramp-archive-tests.el +++ b/test/lisp/net/tramp-archive-tests.el | |||
| @@ -872,7 +872,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 872 | (let ((fsi (file-system-info tramp-archive-test-archive))) | 872 | (let ((fsi (file-system-info tramp-archive-test-archive))) |
| 873 | (skip-unless fsi) | 873 | (skip-unless fsi) |
| 874 | (should (and (consp fsi) | 874 | (should (and (consp fsi) |
| 875 | (= (length fsi) 3) | 875 | (tramp-compat-length= fsi 3) |
| 876 | (numberp (nth 0 fsi)) | 876 | (numberp (nth 0 fsi)) |
| 877 | ;; FREE and AVAIL are always 0. | 877 | ;; FREE and AVAIL are always 0. |
| 878 | (zerop (nth 1 fsi)) | 878 | (zerop (nth 1 fsi)) |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 918929f55e4..6172535a655 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -4516,17 +4516,17 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4516 | (and (string-match-p tramp-ipv6-regexp host) | 4516 | (and (string-match-p tramp-ipv6-regexp host) |
| 4517 | tramp-postfix-ipv6-format))) | 4517 | tramp-postfix-ipv6-format))) |
| 4518 | ;; Complete method name. | 4518 | ;; Complete method name. |
| 4519 | (unless (or (zerop (length method)) | 4519 | (unless (or (tramp-string-empty-or-nil-p method) |
| 4520 | (zerop (length tramp-method-regexp))) | 4520 | (string-empty-p tramp-method-regexp)) |
| 4521 | (should | 4521 | (should |
| 4522 | (member | 4522 | (member |
| 4523 | (concat prefix-format method tramp-postfix-method-format) | 4523 | (concat prefix-format method tramp-postfix-method-format) |
| 4524 | (file-name-all-completions | 4524 | (file-name-all-completions |
| 4525 | (concat prefix-format (substring method 0 1)) "/")))) | 4525 | (concat prefix-format (substring method 0 1)) "/")))) |
| 4526 | ;; Complete host name. | 4526 | ;; Complete host name. |
| 4527 | (unless (or (zerop (length method)) | 4527 | (unless (or (tramp-string-empty-or-nil-p method) |
| 4528 | (zerop (length tramp-method-regexp)) | 4528 | (string-empty-p tramp-method-regexp) |
| 4529 | (zerop (length host)) | 4529 | (tramp-string-empty-or-nil-p host) |
| 4530 | (tramp--test-gvfs-p method)) | 4530 | (tramp--test-gvfs-p method)) |
| 4531 | (should | 4531 | (should |
| 4532 | (member | 4532 | (member |
| @@ -5370,7 +5370,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." | |||
| 5370 | (when-let ((default-directory ert-remote-temporary-file-directory) | 5370 | (when-let ((default-directory ert-remote-temporary-file-directory) |
| 5371 | (mi (memory-info))) | 5371 | (mi (memory-info))) |
| 5372 | (should (consp mi)) | 5372 | (should (consp mi)) |
| 5373 | (should (= (length mi) 4)) | 5373 | (should (tramp-compat-length= mi 4)) |
| 5374 | (dotimes (i (length mi)) | 5374 | (dotimes (i (length mi)) |
| 5375 | (should (natnump (nth i mi)))))) | 5375 | (should (natnump (nth i mi)))))) |
| 5376 | 5376 | ||
| @@ -5915,7 +5915,8 @@ INPUT, if non-nil, is a string sent to the process." | |||
| 5915 | ;; We make a super long `tramp-remote-path'. | 5915 | ;; We make a super long `tramp-remote-path'. |
| 5916 | (make-directory tmp-name) | 5916 | (make-directory tmp-name) |
| 5917 | (should (file-directory-p tmp-name)) | 5917 | (should (file-directory-p tmp-name)) |
| 5918 | (while (< (length (mapconcat #'identity orig-exec-path ":")) 5000) | 5918 | (while (tramp-compat-length< |
| 5919 | (mapconcat #'identity orig-exec-path ":") 5000) | ||
| 5919 | (let ((dir (make-temp-file (file-name-as-directory tmp-name) 'dir))) | 5920 | (let ((dir (make-temp-file (file-name-as-directory tmp-name) 'dir))) |
| 5920 | (should (file-directory-p dir)) | 5921 | (should (file-directory-p dir)) |
| 5921 | (setq tramp-remote-path | 5922 | (setq tramp-remote-path |
| @@ -5931,9 +5932,10 @@ INPUT, if non-nil, is a string sent to the process." | |||
| 5931 | ;; Ignore trailing newline. | 5932 | ;; Ignore trailing newline. |
| 5932 | (setq path (substring (shell-command-to-string "echo $PATH") nil -1)) | 5933 | (setq path (substring (shell-command-to-string "echo $PATH") nil -1)) |
| 5933 | ;; The shell doesn't handle such long strings. | 5934 | ;; The shell doesn't handle such long strings. |
| 5934 | (when (<= (length path) | 5935 | (unless (tramp-compat-length> |
| 5935 | (tramp-get-connection-property | 5936 | path |
| 5936 | tramp-test-vec "pipe-buf" 4096)) | 5937 | (tramp-get-connection-property |
| 5938 | tramp-test-vec "pipe-buf" 4096)) | ||
| 5937 | ;; The last element of `exec-path' is `exec-directory'. | 5939 | ;; The last element of `exec-path' is `exec-directory'. |
| 5938 | (should | 5940 | (should |
| 5939 | (string-equal | 5941 | (string-equal |
| @@ -7070,7 +7072,7 @@ This requires restrictions of file name syntax." | |||
| 7070 | 7072 | ||
| 7071 | (when-let ((fsi (file-system-info ert-remote-temporary-file-directory))) | 7073 | (when-let ((fsi (file-system-info ert-remote-temporary-file-directory))) |
| 7072 | (should (consp fsi)) | 7074 | (should (consp fsi)) |
| 7073 | (should (= (length fsi) 3)) | 7075 | (should (tramp-compat-length= fsi 3)) |
| 7074 | (dotimes (i (length fsi)) | 7076 | (dotimes (i (length fsi)) |
| 7075 | (should (natnump (or (nth i fsi) 0)))))) | 7077 | (should (natnump (or (nth i fsi) 0)))))) |
| 7076 | 7078 | ||