summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSteve Purcell <steve@sanityinc.com>2017-03-18 15:24:49 +1300
committerDavid Shepherd <davidshepherd7@gmail.com>2017-03-19 15:37:40 +0000
commit5d759db6713420ed4ab5c5cbef891871399ad25d (patch)
tree7dd6d4d5cdf2edf2dfcf4890213d0f41763d0ddc /test
parentSimplify default terminal command and add missing defgroup (diff)
downloademacs-terminal-here-5d759db6713420ed4ab5c5cbef891871399ad25d.tar.gz
Use a defcustom to control the project root function
Diffstat (limited to 'test')
-rw-r--r--test/terminal-here-test.el32
1 files changed, 14 insertions, 18 deletions
diff --git a/test/terminal-here-test.el b/test/terminal-here-test.el
index 24f5ca4..58adbef 100644
--- a/test/terminal-here-test.el
+++ b/test/terminal-here-test.el
@@ -43,23 +43,19 @@
-(ert-deftest projectile-root ()
- (with-mock
- (mock (projectile-project-root) => "project-root")
- (mock (terminal-here-launch-in-directory "project-root"))
- (terminal-here-project-launch)))
+(ert-deftest no-project-root-function ()
+ ;; Can't use validate setq here because you aren't allowed to set this to nil
+ ;; by hand.
+ (setq terminal-here-project-root-function nil)
+ (should-error (terminal-here-project-launch) :type 'user-error))
-(ert-deftest non-projectile-project-root ()
- (with-mock
- (should (not (boundp 'projectile-project-root)))
- (mock (vc-root-dir) => "vc-root")
- (mock (terminal-here-launch-in-directory "vc-root"))
- (terminal-here-project-launch)))
+(ert-deftest with-project-root-function ()
+ (let ((project-root-finder (lambda () "" "vc-root")))
+ (validate-setq terminal-here-project-root-function project-root-finder)
+ (with-mock
+ (mock (terminal-here-launch-in-directory "vc-root"))
+ (terminal-here-project-launch))))
-(ert-deftest no-root-found ()
- (with-mock
- (mock (projectile-project-root) => nil)
- (mock (vc-root-dir) => nil)
- (should-error
- (terminal-here-project-launch)
- :type 'user-error)))
+(ert-deftest project-root-finds-nothing ()
+ (validate-setq terminal-here-project-root-function (lambda () nil))
+ (should-error (terminal-here-project-launch :type 'user-error)))