aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2024-05-08 13:44:15 +0200
committerMichael Albinus2024-05-08 13:44:15 +0200
commit339b8349f436b3738cfa02b236e05c3da4c5a8a5 (patch)
tree213fe7fefebd087c685bc7cf3c2c1171a4ef094b /test
parente020f4e9ce5d98438033fea098d943c311b0fa3d (diff)
downloademacs-339b8349f436b3738cfa02b236e05c3da4c5a8a5.tar.gz
emacs-339b8349f436b3738cfa02b236e05c3da4c5a8a5.zip
More Tramp optional methods
* doc/misc/tramp.texi (Inline methods) <krlogin, ksu>: (External methods) <fcp, nc>: These are optional methods. * etc/NEWS: Mention more optional Tramp methods. * lisp/net/tramp-androidsu.el (tramp-enable-androidsu-method): Use proper regexp for `tramp-default-user-alist'. * lisp/net/tramp-sh.el (tramp-enable-nc-method) (tramp-enable-ksu-method, tramp-enable-krlogin-method) (tramp-enable-fcp-method): New defuns. Move respective configurations there. * lisp/net/tramp.el (tramp-enable-method): Implement completion for interactive use. * test/lisp/net/tramp-tests.el (tramp-test03-file-name-defaults) (tramp-test03-file-name-host-rules): Extend tests.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el45
1 files changed, 25 insertions, 20 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 68095c93a00..f7c83f3b8eb 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2103,14 +2103,18 @@ is greater than 10.
2103 (string-equal (file-remote-p (format "/-:%s@:" u) 'method) "ftp")))) 2103 (string-equal (file-remote-p (format "/-:%s@:" u) 'method) "ftp"))))
2104 ;; Default values in tramp-sh.el and tramp-sudoedit.el. 2104 ;; Default values in tramp-sh.el and tramp-sudoedit.el.
2105 (when (assoc "su" tramp-methods) 2105 (when (assoc "su" tramp-methods)
2106 (dolist (h `("127.0.0.1" "[::1]" "localhost" "localhost6" ,(system-name))) 2106 (dolist
2107 (h `("127.0.0.1" "[::1]" "localhost" "localhost4" "localhost6"
2108 "ip6-localhost" "ip6-loopback" ,(system-name)))
2107 (should 2109 (should
2108 (string-equal (file-remote-p (format "/-:root@%s:" h) 'method) "su"))) 2110 (string-equal (file-remote-p (format "/-:root@%s:" h) 'method) "su"))))
2109 (dolist (m '("su" "sudo" "ksu" "doas" "sudoedit")) 2111 (dolist (m '("su" "sudo" "ksu" "doas" "sudoedit"))
2112 (when (assoc m tramp-methods)
2110 (should (string-equal (file-remote-p (format "/%s::" m) 'user) "root")) 2113 (should (string-equal (file-remote-p (format "/%s::" m) 'user) "root"))
2111 (should 2114 (should
2112 (string-equal (file-remote-p (format "/%s::" m) 'host) (system-name)))) 2115 (string-equal (file-remote-p (format "/%s::" m) 'host) (system-name)))))
2113 (dolist (m '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp" "nc")) 2116 (dolist (m '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp" "nc"))
2117 (when (assoc m tramp-methods)
2114 (should 2118 (should
2115 (string-equal 2119 (string-equal
2116 (file-remote-p (format "/%s::" m) 'user) (user-login-name))))) 2120 (file-remote-p (format "/%s::" m) 'user) (user-login-name)))))
@@ -2128,21 +2132,22 @@ is greater than 10.
2128 ;; Host names must match rules in case the command template of a 2132 ;; Host names must match rules in case the command template of a
2129 ;; method doesn't use them. 2133 ;; method doesn't use them.
2130 (dolist (m '("su" "sg" "sudo" "doas" "ksu")) 2134 (dolist (m '("su" "sg" "sudo" "doas" "ksu"))
2131 (let (tramp-connection-properties tramp-default-proxies-alist) 2135 (when (assoc m tramp-methods)
2132 (ignore-errors 2136 (let (tramp-connection-properties tramp-default-proxies-alist)
2133 (tramp-cleanup-connection tramp-test-vec nil 'keep-password)) 2137 (ignore-errors
2134 ;; Single hop. The host name must match `tramp-local-host-regexp'. 2138 (tramp-cleanup-connection tramp-test-vec nil 'keep-password))
2135 (should-error 2139 ;; Single hop. The host name must match `tramp-local-host-regexp'.
2136 (find-file (format "/%s:foo:" m)) 2140 (should-error
2137 :type 'user-error) 2141 (find-file (format "/%s:foo:" m))
2138 ;; Multi hop. The host name must match the previous hop. 2142 :type 'user-error)
2139 (should-error 2143 ;; Multi hop. The host name must match the previous hop.
2140 (find-file 2144 (should-error
2141 (format 2145 (find-file
2142 "%s|%s:foo:" 2146 (format
2143 (substring (file-remote-p ert-remote-temporary-file-directory) 0 -1) 2147 "%s|%s:foo:"
2144 m)) 2148 (substring (file-remote-p ert-remote-temporary-file-directory) 0 -1)
2145 :type 'user-error)))) 2149 m))
2150 :type 'user-error)))))
2146 2151
2147(ert-deftest tramp-test03-file-name-method-rules () 2152(ert-deftest tramp-test03-file-name-method-rules ()
2148 "Check file name rules for some methods." 2153 "Check file name rules for some methods."