diff options
| author | Michael Albinus | 2022-02-06 18:50:16 +0100 |
|---|---|---|
| committer | Michael Albinus | 2022-02-06 18:50:16 +0100 |
| commit | 8b35f64ff90adcbb55bb9fe9a0871b99a873200a (patch) | |
| tree | 8d880c060887305a6453aa3106e38f93defe1045 /test | |
| parent | 1850121629d19515130225232bbc020a168aee2e (diff) | |
| download | emacs-8b35f64ff90adcbb55bb9fe9a0871b99a873200a.tar.gz emacs-8b35f64ff90adcbb55bb9fe9a0871b99a873200a.zip | |
Adapt em-tramp-tests.el
* 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.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/eshell/em-tramp-tests.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/test/lisp/eshell/em-tramp-tests.el b/test/lisp/eshell/em-tramp-tests.el index 7f054da5143..8969c1e2294 100644 --- a/test/lisp/eshell/em-tramp-tests.el +++ b/test/lisp/eshell/em-tramp-tests.el | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | (require 'em-tramp) | 23 | (require 'em-tramp) |
| 24 | (require 'tramp) | ||
| 24 | 25 | ||
| 25 | (ert-deftest em-tramp-test/su-default () | 26 | (ert-deftest em-tramp-test/su-default () |
| 26 | "Test Eshell `su' command with no arguments." | 27 | "Test Eshell `su' command with no arguments." |
| @@ -29,7 +30,8 @@ | |||
| 29 | `(eshell-trap-errors | 30 | `(eshell-trap-errors |
| 30 | (eshell-named-command | 31 | (eshell-named-command |
| 31 | "cd" | 32 | "cd" |
| 32 | (list ,(format "/su:root@localhost:%s" default-directory))))))) | 33 | (list ,(format "/su:root@%s:%s" |
| 34 | tramp-default-host default-directory))))))) | ||
| 33 | 35 | ||
| 34 | (ert-deftest em-tramp-test/su-user () | 36 | (ert-deftest em-tramp-test/su-user () |
| 35 | "Test Eshell `su' command with USER argument." | 37 | "Test Eshell `su' command with USER argument." |
| @@ -38,7 +40,8 @@ | |||
| 38 | `(eshell-trap-errors | 40 | `(eshell-trap-errors |
| 39 | (eshell-named-command | 41 | (eshell-named-command |
| 40 | "cd" | 42 | "cd" |
| 41 | (list ,(format "/su:USER@localhost:%s" default-directory))))))) | 43 | (list ,(format "/su:USER@%s:%s" |
| 44 | tramp-default-host default-directory))))))) | ||
| 42 | 45 | ||
| 43 | (ert-deftest em-tramp-test/su-login () | 46 | (ert-deftest em-tramp-test/su-login () |
| 44 | "Test Eshell `su' command with -/-l/--login option." | 47 | "Test Eshell `su' command with -/-l/--login option." |
| @@ -50,7 +53,7 @@ | |||
| 50 | `(eshell-trap-errors | 53 | `(eshell-trap-errors |
| 51 | (eshell-named-command | 54 | (eshell-named-command |
| 52 | "cd" | 55 | "cd" |
| 53 | (list "/su:root@localhost:~/"))))))) | 56 | (list ,(format "/su:root@%s:~/" tramp-default-host)))))))) |
| 54 | 57 | ||
| 55 | (defun mock-eshell-named-command (&rest args) | 58 | (defun mock-eshell-named-command (&rest args) |
| 56 | "Dummy function to test Eshell `sudo' command rewriting." | 59 | "Dummy function to test Eshell `sudo' command rewriting." |
| @@ -62,11 +65,11 @@ | |||
| 62 | #'mock-eshell-named-command)) | 65 | #'mock-eshell-named-command)) |
| 63 | (should (equal | 66 | (should (equal |
| 64 | (catch 'eshell-external (eshell/sudo "echo" "hi")) | 67 | (catch 'eshell-external (eshell/sudo "echo" "hi")) |
| 65 | `(,(format "/sudo:root@localhost:%s" default-directory) | 68 | `(,(format "/sudo:root@%s:%s" tramp-default-host default-directory) |
| 66 | ("echo" ("hi"))))) | 69 | ("echo" ("hi"))))) |
| 67 | (should (equal | 70 | (should (equal |
| 68 | (catch 'eshell-external (eshell/sudo "echo" "-u" "hi")) | 71 | (catch 'eshell-external (eshell/sudo "echo" "-u" "hi")) |
| 69 | `(,(format "/sudo:root@localhost:%s" default-directory) | 72 | `(,(format "/sudo:root@%s:%s" tramp-default-host default-directory) |
| 70 | ("echo" ("-u" "hi"))))))) | 73 | ("echo" ("-u" "hi"))))))) |
| 71 | 74 | ||
| 72 | (ert-deftest em-tramp-test/sudo-user () | 75 | (ert-deftest em-tramp-test/sudo-user () |
| @@ -75,11 +78,11 @@ | |||
| 75 | #'mock-eshell-named-command)) | 78 | #'mock-eshell-named-command)) |
| 76 | (should (equal | 79 | (should (equal |
| 77 | (catch 'eshell-external (eshell/sudo "-u" "USER" "echo" "hi")) | 80 | (catch 'eshell-external (eshell/sudo "-u" "USER" "echo" "hi")) |
| 78 | `(,(format "/sudo:USER@localhost:%s" default-directory) | 81 | `(,(format "/sudo:USER@%s:%s" tramp-default-host default-directory) |
| 79 | ("echo" ("hi"))))) | 82 | ("echo" ("hi"))))) |
| 80 | (should (equal | 83 | (should (equal |
| 81 | (catch 'eshell-external (eshell/sudo "-u" "USER" "echo" "-u" "hi")) | 84 | (catch 'eshell-external (eshell/sudo "-u" "USER" "echo" "-u" "hi")) |
| 82 | `(,(format "/sudo:USER@localhost:%s" default-directory) | 85 | `(,(format "/sudo:USER@%s:%s" tramp-default-host default-directory) |
| 83 | ("echo" ("-u" "hi"))))))) | 86 | ("echo" ("-u" "hi"))))))) |
| 84 | 87 | ||
| 85 | ;;; em-tramp-tests.el ends here | 88 | ;;; em-tramp-tests.el ends here |