aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/lisp/net/tramp-tests.el144
1 files changed, 140 insertions, 4 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 24dfee55134..d6c7d478425 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."
372 "Check remote file name components." 372 "Check remote file name components."
373 (let ((tramp-default-method "default-method") 373 (let ((tramp-default-method "default-method")
374 (tramp-default-user "default-user") 374 (tramp-default-user "default-user")
375 (tramp-default-host "default-host")) 375 (tramp-default-host "default-host")
376 tramp-default-method-alist
377 tramp-default-user-alist
378 tramp-default-host-alist)
376 ;; Expand `tramp-default-user' and `tramp-default-host'. 379 ;; Expand `tramp-default-user' and `tramp-default-host'.
377 (should (string-equal 380 (should (string-equal
378 (file-remote-p "/method::") 381 (file-remote-p "/method::")
@@ -722,7 +725,55 @@ handled properly. BODY shall not contain a timeout."
722 "|method3:user3@host3:/path/to/file") 725 "|method3:user3@host3:/path/to/file")
723 'hop) 726 'hop)
724 (format "%s:%s@%s|%s:%s@%s|" 727 (format "%s:%s@%s|%s:%s@%s|"
725 "method1" "user1" "host1" "method2" "user2" "host2"))))) 728 "method1" "user1" "host1" "method2" "user2" "host2")))
729
730 ;; Expand `tramp-default-method-alist'.
731 (add-to-list 'tramp-default-method-alist '("host1" "user1" "method1"))
732 (add-to-list 'tramp-default-method-alist '("host2" "user2" "method2"))
733 (add-to-list 'tramp-default-method-alist '("host3" "user3" "method3"))
734 (should
735 (string-equal
736 (file-remote-p
737 (concat
738 "/-:user1@host1"
739 "|-:user2@host2"
740 "|-:user3@host3:/path/to/file"))
741 (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:"
742 "-" "user1" "host1"
743 "-" "user2" "host2"
744 "method3" "user3" "host3")))
745
746 ;; Expand `tramp-default-user-alist'.
747 (add-to-list 'tramp-default-user-alist '("method1" "host1" "user1"))
748 (add-to-list 'tramp-default-user-alist '("method2" "host2" "user2"))
749 (add-to-list 'tramp-default-user-alist '("method3" "host3" "user3"))
750 (should
751 (string-equal
752 (file-remote-p
753 (concat
754 "/method1:host1"
755 "|method2:host2"
756 "|method3:host3:/path/to/file"))
757 (format "/%s:%s|%s:%s|%s:%s@%s:"
758 "method1" "host1"
759 "method2" "host2"
760 "method3" "user3" "host3")))
761
762 ;; Expand `tramp-default-host-alist'.
763 (add-to-list 'tramp-default-host-alist '("method1" "user1" "host1"))
764 (add-to-list 'tramp-default-host-alist '("method2" "user2" "host2"))
765 (add-to-list 'tramp-default-host-alist '("method3" "user3" "host3"))
766 (should
767 (string-equal
768 (file-remote-p
769 (concat
770 "/method1:user1@"
771 "|method2:user2@"
772 "|method3:user3@:/path/to/file"))
773 (format "/%s:%s@|%s:%s@|%s:%s@%s:"
774 "method1" "user1"
775 "method2" "user2"
776 "method3" "user3" "host3")))))
726 777
727(ert-deftest tramp-test02-file-name-dissect-simplified () 778(ert-deftest tramp-test02-file-name-dissect-simplified ()
728 "Check simplified file name components." 779 "Check simplified file name components."
@@ -730,6 +781,8 @@ handled properly. BODY shall not contain a timeout."
730 (let ((tramp-default-method "default-method") 781 (let ((tramp-default-method "default-method")
731 (tramp-default-user "default-user") 782 (tramp-default-user "default-user")
732 (tramp-default-host "default-host") 783 (tramp-default-host "default-host")
784 tramp-default-user-alist
785 tramp-default-host-alist
733 (syntax tramp-syntax)) 786 (syntax tramp-syntax))
734 (unwind-protect 787 (unwind-protect
735 (progn 788 (progn
@@ -977,7 +1030,39 @@ handled properly. BODY shall not contain a timeout."
977 "|user3@host3:/path/to/file") 1030 "|user3@host3:/path/to/file")
978 'hop) 1031 'hop)
979 (format "%s@%s|%s@%s|" 1032 (format "%s@%s|%s@%s|"
980 "user1" "host1" "user2" "host2")))) 1033 "user1" "host1" "user2" "host2")))
1034
1035 ;; Expand `tramp-default-user-alist'.
1036 (add-to-list 'tramp-default-user-alist '(nil "host1" "user1"))
1037 (add-to-list 'tramp-default-user-alist '(nil "host2" "user2"))
1038 (add-to-list 'tramp-default-user-alist '(nil "host3" "user3"))
1039 (should
1040 (string-equal
1041 (file-remote-p
1042 (concat
1043 "/host1"
1044 "|host2"
1045 "|host3:/path/to/file"))
1046 (format "/%s|%s|%s@%s:"
1047 "host1"
1048 "host2"
1049 "user3" "host3")))
1050
1051 ;; Expand `tramp-default-host-alist'.
1052 (add-to-list 'tramp-default-host-alist '(nil "user1" "host1"))
1053 (add-to-list 'tramp-default-host-alist '(nil "user2" "host2"))
1054 (add-to-list 'tramp-default-host-alist '(nil "user3" "host3"))
1055 (should
1056 (string-equal
1057 (file-remote-p
1058 (concat
1059 "/user1@"
1060 "|user2@"
1061 "|user3@:/path/to/file"))
1062 (format "/%s@|%s@|%s@%s:"
1063 "user1"
1064 "user2"
1065 "user3" "host3"))))
981 1066
982 ;; Exit. 1067 ;; Exit.
983 (tramp-change-syntax syntax)))) 1068 (tramp-change-syntax syntax))))
@@ -988,6 +1073,9 @@ handled properly. BODY shall not contain a timeout."
988 (let ((tramp-default-method "default-method") 1073 (let ((tramp-default-method "default-method")
989 (tramp-default-user "default-user") 1074 (tramp-default-user "default-user")
990 (tramp-default-host "default-host") 1075 (tramp-default-host "default-host")
1076 tramp-default-method-alist
1077 tramp-default-user-alist
1078 tramp-default-host-alist
991 (syntax tramp-syntax)) 1079 (syntax tramp-syntax))
992 (unwind-protect 1080 (unwind-protect
993 (progn 1081 (progn
@@ -1545,7 +1633,55 @@ handled properly. BODY shall not contain a timeout."
1545 "|method3/user3@host3]/path/to/file") 1633 "|method3/user3@host3]/path/to/file")
1546 'hop) 1634 'hop)
1547 (format "%s/%s@%s|%s/%s@%s|" 1635 (format "%s/%s@%s|%s/%s@%s|"
1548 "method1" "user1" "host1" "method2" "user2" "host2")))) 1636 "method1" "user1" "host1" "method2" "user2" "host2")))
1637
1638 ;; Expand `tramp-default-method-alist'.
1639 (add-to-list 'tramp-default-method-alist '("host1" "user1" "method1"))
1640 (add-to-list 'tramp-default-method-alist '("host2" "user2" "method2"))
1641 (add-to-list 'tramp-default-method-alist '("host3" "user3" "method3"))
1642 (should
1643 (string-equal
1644 (file-remote-p
1645 (concat
1646 "/[/user1@host1"
1647 "|/user2@host2"
1648 "|/user3@host3]/path/to/file"))
1649 (format "/[/%s@%s|/%s@%s|%s/%s@%s]"
1650 "user1" "host1"
1651 "user2" "host2"
1652 "method3" "user3" "host3")))
1653
1654 ;; Expand `tramp-default-user-alist'.
1655 (add-to-list 'tramp-default-user-alist '("method1" "host1" "user1"))
1656 (add-to-list 'tramp-default-user-alist '("method2" "host2" "user2"))
1657 (add-to-list 'tramp-default-user-alist '("method3" "host3" "user3"))
1658 (should
1659 (string-equal
1660 (file-remote-p
1661 (concat
1662 "/[method1/host1"
1663 "|method2/host2"
1664 "|method3/host3]/path/to/file"))
1665 (format "/[%s/%s|%s/%s|%s/%s@%s]"
1666 "method1" "host1"
1667 "method2" "host2"
1668 "method3" "user3" "host3")))
1669
1670 ;; Expand `tramp-default-host-alist'.
1671 (add-to-list 'tramp-default-host-alist '("method1" "user1" "host1"))
1672 (add-to-list 'tramp-default-host-alist '("method2" "user2" "host2"))
1673 (add-to-list 'tramp-default-host-alist '("method3" "user3" "host3"))
1674 (should
1675 (string-equal
1676 (file-remote-p
1677 (concat
1678 "/[method1/user1@"
1679 "|method2/user2@"
1680 "|method3/user3@]/path/to/file"))
1681 (format "/[%s/%s@|%s/%s@|%s/%s@%s]"
1682 "method1" "user1"
1683 "method2" "user2"
1684 "method3" "user3" "host3"))))
1549 1685
1550 ;; Exit. 1686 ;; Exit.
1551 (tramp-change-syntax syntax)))) 1687 (tramp-change-syntax syntax))))