[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master f0c1277: Extend tramp-test02-file-name-dissect* tes
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] master f0c1277: Extend tramp-test02-file-name-dissect* tests |
Date: |
Sat, 20 Jan 2018 18:14:46 -0500 (EST) |
branch: master
commit f0c1277af5efafbc5e386affabc1ec3368e8a790
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
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'.
---
test/lisp/net/tramp-tests.el | 144 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 140 insertions(+), 4 deletions(-)
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 24dfee5..d6c7d47 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -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:address@hidden:/path/to/file")
'hop)
(format "%s:address@hidden|%s:address@hidden|"
- "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
+ "/-:address@hidden"
+ "|-:address@hidden"
+ "|-:address@hidden:/path/to/file"))
+ (format "/%s:address@hidden|%s:address@hidden|%s:address@hidden:"
+ "-" "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:address@hidden:"
+ "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:address@hidden:"
+ "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."
"|address@hidden:/path/to/file")
'hop)
(format "address@hidden|address@hidden|"
- "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|address@hidden:"
+ "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@|address@hidden:"
+ "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/address@hidden/path/to/file")
'hop)
(format "%s/address@hidden|%s/address@hidden|"
- "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
+ "/[/address@hidden"
+ "|/address@hidden"
+ "|/address@hidden/path/to/file"))
+ (format "/[/address@hidden|/address@hidden|%s/address@hidden"
+ "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/address@hidden"
+ "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/address@hidden/path/to/file"))
+ (format "/[%s/%s@|%s/%s@|%s/address@hidden"
+ "method1" "user1"
+ "method2" "user2"
+ "method3" "user3" "host3"))))
;; Exit.
(tramp-change-syntax syntax))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master f0c1277: Extend tramp-test02-file-name-dissect* tests,
Michael Albinus <=