]> git.eshelyaron.com Git - emacs.git/commitdiff
Adapt em-tramp-tests.el
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 6 Feb 2022 17:50:16 +0000 (18:50 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 6 Feb 2022 17:50:16 +0000 (18:50 +0100)
* test/lisp/eshell/em-tramp-tests.el (tramp): Require.
(em-tramp-test/su-default, em-tramp-test/su-user)
(em-tramp-test/su-login, em-tramp-test/sudo-basic)
(em-tramp-test/sudo-user): Adapt tests.

test/lisp/eshell/em-tramp-tests.el

index 7f054da5143db9fe57edf9a7575a1110cd82ab9c..8969c1e2294d125a252e0fee38c65a19e0c4812f 100644 (file)
@@ -21,6 +21,7 @@
 
 (require 'ert)
 (require 'em-tramp)
+(require 'tramp)
 
 (ert-deftest em-tramp-test/su-default ()
   "Test Eshell `su' command with no arguments."
@@ -29,7 +30,8 @@
            `(eshell-trap-errors
              (eshell-named-command
               "cd"
-              (list ,(format "/su:root@localhost:%s" default-directory)))))))
+              (list ,(format "/su:root@%s:%s"
+                             tramp-default-host default-directory)))))))
 
 (ert-deftest em-tramp-test/su-user ()
   "Test Eshell `su' command with USER argument."
@@ -38,7 +40,8 @@
            `(eshell-trap-errors
              (eshell-named-command
               "cd"
-              (list ,(format "/su:USER@localhost:%s" default-directory)))))))
+              (list ,(format "/su:USER@%s:%s"
+                             tramp-default-host default-directory)))))))
 
 (ert-deftest em-tramp-test/su-login ()
   "Test Eshell `su' command with -/-l/--login option."
@@ -50,7 +53,7 @@
              `(eshell-trap-errors
                (eshell-named-command
                 "cd"
-                (list "/su:root@localhost:~/")))))))
+                (list ,(format "/su:root@%s:~/" tramp-default-host))))))))
 
 (defun mock-eshell-named-command (&rest args)
   "Dummy function to test Eshell `sudo' command rewriting."
              #'mock-eshell-named-command))
     (should (equal
              (catch 'eshell-external (eshell/sudo "echo" "hi"))
-             `(,(format "/sudo:root@localhost:%s" default-directory)
+             `(,(format "/sudo:root@%s:%s" tramp-default-host default-directory)
                ("echo" ("hi")))))
     (should (equal
              (catch 'eshell-external (eshell/sudo "echo" "-u" "hi"))
-             `(,(format "/sudo:root@localhost:%s" default-directory)
+             `(,(format "/sudo:root@%s:%s" tramp-default-host default-directory)
                ("echo" ("-u" "hi")))))))
 
 (ert-deftest em-tramp-test/sudo-user ()
              #'mock-eshell-named-command))
     (should (equal
              (catch 'eshell-external (eshell/sudo "-u" "USER" "echo" "hi"))
-             `(,(format "/sudo:USER@localhost:%s" default-directory)
+             `(,(format "/sudo:USER@%s:%s" tramp-default-host default-directory)
                ("echo" ("hi")))))
     (should (equal
              (catch 'eshell-external (eshell/sudo "-u" "USER" "echo" "-u" "hi"))
-             `(,(format "/sudo:USER@localhost:%s" default-directory)
+             `(,(format "/sudo:USER@%s:%s" tramp-default-host default-directory)
                ("echo" ("-u" "hi")))))))
 
 ;;; em-tramp-tests.el ends here