mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-24 10:38:38 +00:00
Extend tramp-test02-file-name-dissect* tests
* test/lisp/net/tramp-tests.el (tramp-test02-file-name-dissect) (tramp-test02-file-name-dissect-simplified) (tramp-test02-file-name-dissect-separate): Test also `tramp-default-method-alist', `tramp-default-user-alist' and `tramp-default-host-alist'.
This commit is contained in:
parent
3a34d14630
commit
f0c1277af5
@ -372,7 +372,10 @@ handled properly. BODY shall not contain a timeout."
|
||||
"Check remote file name components."
|
||||
(let ((tramp-default-method "default-method")
|
||||
(tramp-default-user "default-user")
|
||||
(tramp-default-host "default-host"))
|
||||
(tramp-default-host "default-host")
|
||||
tramp-default-method-alist
|
||||
tramp-default-user-alist
|
||||
tramp-default-host-alist)
|
||||
;; Expand `tramp-default-user' and `tramp-default-host'.
|
||||
(should (string-equal
|
||||
(file-remote-p "/method::")
|
||||
@ -722,7 +725,55 @@ handled properly. BODY shall not contain a timeout."
|
||||
"|method3:user3@host3:/path/to/file")
|
||||
'hop)
|
||||
(format "%s:%s@%s|%s:%s@%s|"
|
||||
"method1" "user1" "host1" "method2" "user2" "host2")))))
|
||||
"method1" "user1" "host1" "method2" "user2" "host2")))
|
||||
|
||||
;; Expand `tramp-default-method-alist'.
|
||||
(add-to-list 'tramp-default-method-alist '("host1" "user1" "method1"))
|
||||
(add-to-list 'tramp-default-method-alist '("host2" "user2" "method2"))
|
||||
(add-to-list 'tramp-default-method-alist '("host3" "user3" "method3"))
|
||||
(should
|
||||
(string-equal
|
||||
(file-remote-p
|
||||
(concat
|
||||
"/-:user1@host1"
|
||||
"|-:user2@host2"
|
||||
"|-:user3@host3:/path/to/file"))
|
||||
(format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:"
|
||||
"-" "user1" "host1"
|
||||
"-" "user2" "host2"
|
||||
"method3" "user3" "host3")))
|
||||
|
||||
;; Expand `tramp-default-user-alist'.
|
||||
(add-to-list 'tramp-default-user-alist '("method1" "host1" "user1"))
|
||||
(add-to-list 'tramp-default-user-alist '("method2" "host2" "user2"))
|
||||
(add-to-list 'tramp-default-user-alist '("method3" "host3" "user3"))
|
||||
(should
|
||||
(string-equal
|
||||
(file-remote-p
|
||||
(concat
|
||||
"/method1:host1"
|
||||
"|method2:host2"
|
||||
"|method3:host3:/path/to/file"))
|
||||
(format "/%s:%s|%s:%s|%s:%s@%s:"
|
||||
"method1" "host1"
|
||||
"method2" "host2"
|
||||
"method3" "user3" "host3")))
|
||||
|
||||
;; Expand `tramp-default-host-alist'.
|
||||
(add-to-list 'tramp-default-host-alist '("method1" "user1" "host1"))
|
||||
(add-to-list 'tramp-default-host-alist '("method2" "user2" "host2"))
|
||||
(add-to-list 'tramp-default-host-alist '("method3" "user3" "host3"))
|
||||
(should
|
||||
(string-equal
|
||||
(file-remote-p
|
||||
(concat
|
||||
"/method1:user1@"
|
||||
"|method2:user2@"
|
||||
"|method3:user3@:/path/to/file"))
|
||||
(format "/%s:%s@|%s:%s@|%s:%s@%s:"
|
||||
"method1" "user1"
|
||||
"method2" "user2"
|
||||
"method3" "user3" "host3")))))
|
||||
|
||||
(ert-deftest tramp-test02-file-name-dissect-simplified ()
|
||||
"Check simplified file name components."
|
||||
@ -730,6 +781,8 @@ handled properly. BODY shall not contain a timeout."
|
||||
(let ((tramp-default-method "default-method")
|
||||
(tramp-default-user "default-user")
|
||||
(tramp-default-host "default-host")
|
||||
tramp-default-user-alist
|
||||
tramp-default-host-alist
|
||||
(syntax tramp-syntax))
|
||||
(unwind-protect
|
||||
(progn
|
||||
@ -977,7 +1030,39 @@ handled properly. BODY shall not contain a timeout."
|
||||
"|user3@host3:/path/to/file")
|
||||
'hop)
|
||||
(format "%s@%s|%s@%s|"
|
||||
"user1" "host1" "user2" "host2"))))
|
||||
"user1" "host1" "user2" "host2")))
|
||||
|
||||
;; Expand `tramp-default-user-alist'.
|
||||
(add-to-list 'tramp-default-user-alist '(nil "host1" "user1"))
|
||||
(add-to-list 'tramp-default-user-alist '(nil "host2" "user2"))
|
||||
(add-to-list 'tramp-default-user-alist '(nil "host3" "user3"))
|
||||
(should
|
||||
(string-equal
|
||||
(file-remote-p
|
||||
(concat
|
||||
"/host1"
|
||||
"|host2"
|
||||
"|host3:/path/to/file"))
|
||||
(format "/%s|%s|%s@%s:"
|
||||
"host1"
|
||||
"host2"
|
||||
"user3" "host3")))
|
||||
|
||||
;; Expand `tramp-default-host-alist'.
|
||||
(add-to-list 'tramp-default-host-alist '(nil "user1" "host1"))
|
||||
(add-to-list 'tramp-default-host-alist '(nil "user2" "host2"))
|
||||
(add-to-list 'tramp-default-host-alist '(nil "user3" "host3"))
|
||||
(should
|
||||
(string-equal
|
||||
(file-remote-p
|
||||
(concat
|
||||
"/user1@"
|
||||
"|user2@"
|
||||
"|user3@:/path/to/file"))
|
||||
(format "/%s@|%s@|%s@%s:"
|
||||
"user1"
|
||||
"user2"
|
||||
"user3" "host3"))))
|
||||
|
||||
;; Exit.
|
||||
(tramp-change-syntax syntax))))
|
||||
@ -988,6 +1073,9 @@ handled properly. BODY shall not contain a timeout."
|
||||
(let ((tramp-default-method "default-method")
|
||||
(tramp-default-user "default-user")
|
||||
(tramp-default-host "default-host")
|
||||
tramp-default-method-alist
|
||||
tramp-default-user-alist
|
||||
tramp-default-host-alist
|
||||
(syntax tramp-syntax))
|
||||
(unwind-protect
|
||||
(progn
|
||||
@ -1545,7 +1633,55 @@ handled properly. BODY shall not contain a timeout."
|
||||
"|method3/user3@host3]/path/to/file")
|
||||
'hop)
|
||||
(format "%s/%s@%s|%s/%s@%s|"
|
||||
"method1" "user1" "host1" "method2" "user2" "host2"))))
|
||||
"method1" "user1" "host1" "method2" "user2" "host2")))
|
||||
|
||||
;; Expand `tramp-default-method-alist'.
|
||||
(add-to-list 'tramp-default-method-alist '("host1" "user1" "method1"))
|
||||
(add-to-list 'tramp-default-method-alist '("host2" "user2" "method2"))
|
||||
(add-to-list 'tramp-default-method-alist '("host3" "user3" "method3"))
|
||||
(should
|
||||
(string-equal
|
||||
(file-remote-p
|
||||
(concat
|
||||
"/[/user1@host1"
|
||||
"|/user2@host2"
|
||||
"|/user3@host3]/path/to/file"))
|
||||
(format "/[/%s@%s|/%s@%s|%s/%s@%s]"
|
||||
"user1" "host1"
|
||||
"user2" "host2"
|
||||
"method3" "user3" "host3")))
|
||||
|
||||
;; Expand `tramp-default-user-alist'.
|
||||
(add-to-list 'tramp-default-user-alist '("method1" "host1" "user1"))
|
||||
(add-to-list 'tramp-default-user-alist '("method2" "host2" "user2"))
|
||||
(add-to-list 'tramp-default-user-alist '("method3" "host3" "user3"))
|
||||
(should
|
||||
(string-equal
|
||||
(file-remote-p
|
||||
(concat
|
||||
"/[method1/host1"
|
||||
"|method2/host2"
|
||||
"|method3/host3]/path/to/file"))
|
||||
(format "/[%s/%s|%s/%s|%s/%s@%s]"
|
||||
"method1" "host1"
|
||||
"method2" "host2"
|
||||
"method3" "user3" "host3")))
|
||||
|
||||
;; Expand `tramp-default-host-alist'.
|
||||
(add-to-list 'tramp-default-host-alist '("method1" "user1" "host1"))
|
||||
(add-to-list 'tramp-default-host-alist '("method2" "user2" "host2"))
|
||||
(add-to-list 'tramp-default-host-alist '("method3" "user3" "host3"))
|
||||
(should
|
||||
(string-equal
|
||||
(file-remote-p
|
||||
(concat
|
||||
"/[method1/user1@"
|
||||
"|method2/user2@"
|
||||
"|method3/user3@]/path/to/file"))
|
||||
(format "/[%s/%s@|%s/%s@|%s/%s@%s]"
|
||||
"method1" "user1"
|
||||
"method2" "user2"
|
||||
"method3" "user3" "host3"))))
|
||||
|
||||
;; Exit.
|
||||
(tramp-change-syntax syntax))))
|
||||
|
Loading…
Reference in New Issue
Block a user