summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Shepherd <davidshepherd7@gmail.com>2017-10-22 13:52:34 +0100
committerDavid Shepherd <davidshepherd7@gmail.com>2017-10-22 13:52:34 +0100
commitb3659e13d3d41503b4fc59dd2c7ea622631fc3ec (patch)
treed9a09fba071e56c6161a324e904b9a9a3dd0fc9f /test
parentUpdate .travis.yml (diff)
downloademacs-terminal-here-b3659e13d3d41503b4fc59dd2c7ea622631fc3ec.tar.gz
Add support for file paths opened using tramp and sudo
Fixes #7.
Diffstat (limited to 'test')
-rw-r--r--test/terminal-here-test.el22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/terminal-here-test.el b/test/terminal-here-test.el
index c53c01d..e92f92d 100644
--- a/test/terminal-here-test.el
+++ b/test/terminal-here-test.el
@@ -67,9 +67,29 @@
(let ((project-root-finder (lambda () "" "vc-root")))
(validate-setq terminal-here-project-root-function project-root-finder)
(with-terminal-here-mocks
- (mock (terminal-here-launch-in-directory "vc-root"))
+ (mock (terminal-here--do-launch "vc-root"))
(terminal-here-project-launch))))
(ert-deftest project-root-finds-nothing ()
(validate-setq terminal-here-project-root-function (lambda () nil))
(should-error (terminal-here-project-launch :type 'user-error)))
+
+
+
+(ert-deftest sudo-tramp ()
+ (with-terminal-here-mocks
+ (mock (terminal-here--do-launch "/etc/emacs/"))
+ (terminal-here-launch-in-directory "/sudo:root@localhost:/etc/emacs/"))
+
+ (with-terminal-here-mocks
+ (mock (terminal-here--do-launch "/etc/emacs/"))
+ (terminal-here-launch-in-directory "/sudo:postgres@localhost:/etc/emacs/"))
+
+ (with-terminal-here-mocks
+ (mock (terminal-here--do-launch "/etc/emacs/"))
+ (terminal-here-launch-in-directory "/sudo:root@127.0.0.1:/etc/emacs/")))
+
+(ert-deftest other-tramp-paths-not-handled ()
+ (should-error
+ (terminal-here-launch-in-directory "/ssh:foo@bar.com:/home/foo/my-file")
+ :type 'user-error))