summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Iba <ai@aaroniba.net>2016-03-20 04:26:30 -0700
committerAaron Iba <ai@aaroniba.net>2016-03-20 05:54:31 -0700
commit8102066ca7fef833c0339b0e5ac1aced62007ada (patch)
tree9a620cff453fc8c6f8a8e2e4d3bae97f90a54eaf /test
parent25ce8044230b4e441d515bb3ffa13b396797913f (diff)
Add cider-expected-ns
Diffstat (limited to 'test')
-rw-r--r--test/cider-tests.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/cider-tests.el b/test/cider-tests.el
index 4be1d90a..3a5ee25e 100644
--- a/test/cider-tests.el
+++ b/test/cider-tests.el
@@ -779,3 +779,18 @@
(ert-deftest cider-find-ns-unsupported-op ()
(noflet ((cider-ensure-op-supported (op) nil))
(should-error (cider-find-ns) :type 'user-error)))
+
+(ert-deftest cider-expected-ns ()
+ (noflet ((cider-ensure-connected () t)
+ (cider-sync-request:classpath () '("/a" "/b" "/c" "/c/inner")))
+ (should (string= (cider-expected-ns "/a/foo/bar/baz_utils.clj")
+ "foo.bar.baz-utils"))
+ (should (string= (cider-expected-ns "/b/foo.clj")
+ "foo"))
+ (should (string= (cider-expected-ns "/not/in/classpath.clj")
+ nil))
+ (should (string= (cider-expected-ns "/c/inner/foo/bar.clj")
+ ;; NOT inner.foo.bar
+ "foo.bar"))
+ (should (string= (cider-expected-ns "/c/foo/bar/baz")
+ "foo.bar.baz"))))