summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cider-classpath.el2
-rw-r--r--test/cider-classpath-tests.el8
2 files changed, 10 insertions, 0 deletions
diff --git a/cider-classpath.el b/cider-classpath.el
index 335edd53..2e73d011 100644
--- a/cider-classpath.el
+++ b/cider-classpath.el
@@ -100,6 +100,8 @@
(defun cider-open-classpath-entry ()
"Open a classpath entry."
(interactive)
+ (cider-ensure-connected)
+ (cider-ensure-op-supported "classpath")
(when-let ((entry (completing-read "Classpath entries: " (cider-sync-request:classpath))))
(find-file-other-window entry)))
diff --git a/test/cider-classpath-tests.el b/test/cider-classpath-tests.el
index 82542218..8173ab06 100644
--- a/test/cider-classpath-tests.el
+++ b/test/cider-classpath-tests.el
@@ -10,3 +10,11 @@
(ert-deftest cider-classpath-unsupported-op ()
(noflet ((cider-ensure-op-supported (op) nil))
(should-error (cider-classpath) :type 'user-error)))
+
+(ert-deftest cider-open-classpath-entry-not-connected ()
+ (noflet ((cider-connected-p () nil))
+ (should-error (cider-open-classpath-entry) :type 'user-error)))
+
+(ert-deftest cider-open-classpath-entry-unsupported-op ()
+ (noflet ((cider-ensure-op-supported (op) nil))
+ (should-error (cider-open-classpath-entry) :type 'user-error)))