(require 'ert)
(require 'em-tramp)
+(require 'tramp)
(ert-deftest em-tramp-test/su-default ()
"Test Eshell `su' command with no arguments."
`(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."
`(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."
`(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