mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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.
This commit is contained in:
parent
77ca6aa56e
commit
ead86da14b
11 changed files with 150 additions and 117 deletions
|
|
@ -872,7 +872,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
|
|||
(let ((fsi (file-system-info tramp-archive-test-archive)))
|
||||
(skip-unless fsi)
|
||||
(should (and (consp fsi)
|
||||
(= (length fsi) 3)
|
||||
(tramp-compat-length= fsi 3)
|
||||
(numberp (nth 0 fsi))
|
||||
;; FREE and AVAIL are always 0.
|
||||
(zerop (nth 1 fsi))
|
||||
|
|
|
|||
|
|
@ -4516,17 +4516,17 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
|
|||
(and (string-match-p tramp-ipv6-regexp host)
|
||||
tramp-postfix-ipv6-format)))
|
||||
;; Complete method name.
|
||||
(unless (or (zerop (length method))
|
||||
(zerop (length tramp-method-regexp)))
|
||||
(unless (or (tramp-string-empty-or-nil-p method)
|
||||
(string-empty-p tramp-method-regexp))
|
||||
(should
|
||||
(member
|
||||
(concat prefix-format method tramp-postfix-method-format)
|
||||
(file-name-all-completions
|
||||
(concat prefix-format (substring method 0 1)) "/"))))
|
||||
;; Complete host name.
|
||||
(unless (or (zerop (length method))
|
||||
(zerop (length tramp-method-regexp))
|
||||
(zerop (length host))
|
||||
(unless (or (tramp-string-empty-or-nil-p method)
|
||||
(string-empty-p tramp-method-regexp)
|
||||
(tramp-string-empty-or-nil-p host)
|
||||
(tramp--test-gvfs-p method))
|
||||
(should
|
||||
(member
|
||||
|
|
@ -5370,7 +5370,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
|
|||
(when-let ((default-directory ert-remote-temporary-file-directory)
|
||||
(mi (memory-info)))
|
||||
(should (consp mi))
|
||||
(should (= (length mi) 4))
|
||||
(should (tramp-compat-length= mi 4))
|
||||
(dotimes (i (length mi))
|
||||
(should (natnump (nth i mi))))))
|
||||
|
||||
|
|
@ -5915,7 +5915,8 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
;; We make a super long `tramp-remote-path'.
|
||||
(make-directory tmp-name)
|
||||
(should (file-directory-p tmp-name))
|
||||
(while (< (length (mapconcat #'identity orig-exec-path ":")) 5000)
|
||||
(while (tramp-compat-length<
|
||||
(mapconcat #'identity orig-exec-path ":") 5000)
|
||||
(let ((dir (make-temp-file (file-name-as-directory tmp-name) 'dir)))
|
||||
(should (file-directory-p dir))
|
||||
(setq tramp-remote-path
|
||||
|
|
@ -5931,9 +5932,10 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
;; Ignore trailing newline.
|
||||
(setq path (substring (shell-command-to-string "echo $PATH") nil -1))
|
||||
;; The shell doesn't handle such long strings.
|
||||
(when (<= (length path)
|
||||
(tramp-get-connection-property
|
||||
tramp-test-vec "pipe-buf" 4096))
|
||||
(unless (tramp-compat-length>
|
||||
path
|
||||
(tramp-get-connection-property
|
||||
tramp-test-vec "pipe-buf" 4096))
|
||||
;; The last element of `exec-path' is `exec-directory'.
|
||||
(should
|
||||
(string-equal
|
||||
|
|
@ -7070,7 +7072,7 @@ This requires restrictions of file name syntax."
|
|||
|
||||
(when-let ((fsi (file-system-info ert-remote-temporary-file-directory)))
|
||||
(should (consp fsi))
|
||||
(should (= (length fsi) 3))
|
||||
(should (tramp-compat-length= fsi 3))
|
||||
(dotimes (i (length fsi))
|
||||
(should (natnump (or (nth i fsi) 0))))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue