From b3659e13d3d41503b4fc59dd2c7ea622631fc3ec Mon Sep 17 00:00:00 2001 From: David Shepherd Date: Sun, 22 Oct 2017 13:52:34 +0100 Subject: Add support for file paths opened using tramp and sudo Fixes #7. --- test/terminal-here-test.el | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'test') 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)) -- cgit v1.3