diff options
author | cskksc <ckoparkar@live.in> | 2016-05-18 12:32:44 +0530 |
---|---|---|
committer | cskksc <ckoparkar@live.in> | 2016-05-18 21:46:25 +0530 |
commit | 3074f2b38449d786a820635bbbe8c2a6fbf40a18 (patch) | |
tree | 193d53b27c25ae6b4b8af484db72b49940be444f /test/cider-eldoc-tests.el | |
parent | 5df8bbd012427a71259379cd7612a43dc5d99a4d (diff) |
Refactor some eldoc functions
Diffstat (limited to 'test/cider-eldoc-tests.el')
-rw-r--r-- | test/cider-eldoc-tests.el | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/test/cider-eldoc-tests.el b/test/cider-eldoc-tests.el index 522853cd..dfc5cc50 100644 --- a/test/cider-eldoc-tests.el +++ b/test/cider-eldoc-tests.el @@ -76,47 +76,47 @@ (describe "when ns is given and it exists" (it "returns formatted eldoc strings of form ns/symbol" - (expect (cider-eldoc-format-thing "clojure.core" "map" "map" nil) + (expect (cider-eldoc-format-thing "clojure.core" "map" "map" 'function) :to-equal "clojure.core/map")) (describe "when the given ns doesnt exist" (it "returns eldoc formatted symbol" (let ((cider-eldoc-ns-function (lambda (ns) nil))) - (expect (cider-eldoc-format-thing "non-existent-ns" "" "my-map" nil) + (expect (cider-eldoc-format-thing "non-existent-ns" "" "my-map" 'function) :to-equal "my-map") - (expect (cider-eldoc-format-thing "" "" "my-map" nil) + (expect (cider-eldoc-format-thing "" "" "my-map" 'function) :to-equal "my-map") - (expect (cider-eldoc-format-thing class-names "" ".length" nil) + (expect (cider-eldoc-format-thing class-names "" ".length" 'function) :to-equal ".length"))))) (describe "when the given Java interop form belongs to a single class" (it "returns eldoc formatted thing" - (expect (cider-eldoc-format-thing "java.lang.String" "" ".startsWith" nil) + (expect (cider-eldoc-format-thing "java.lang.String" "" ".startsWith" 'function) :to-equal "java.lang.String/.startsWith"))) (describe "when the given Java interop form belongs to multiple classes" (it "joins the class list into a string" - (expect (cider-eldoc-format-thing class-names "" ".length" nil) + (expect (cider-eldoc-format-thing class-names "" ".length" 'function) :to-equal "(java.lang.String java.lang.StringBuffer java.lang.CharSequence & 1 more)/.length"))) (describe "when cider-eldoc-ns-function is set to cider-abbreviate-ns" (it "abbreviates the class names" (let ((cider-eldoc-ns-function #'cider-abbreviate-ns)) - (expect (cider-eldoc-format-thing "clojure.core" "map" "map" nil) + (expect (cider-eldoc-format-thing "clojure.core" "map" "map" 'function) :to-equal "c.core/map") - (expect (cider-eldoc-format-thing '("java.lang.String") "" ".startsWith" nil) + (expect (cider-eldoc-format-thing '("java.lang.String") "" ".startsWith" 'function) :to-equal "j.l.String/.startsWith") - (expect (cider-eldoc-format-thing class-names "" ".length" nil) + (expect (cider-eldoc-format-thing class-names "" ".length" 'function) :to-equal "(j.l.String j.l.StringBuffer j.l.CharSequence & 1 more)/.length")))) (describe "when cider-eldoc-ns-function is set to cider-last-ns-segment" (it "keeps only the last ns segment" (let ((cider-eldoc-ns-function #'cider-last-ns-segment)) - (expect (cider-eldoc-format-thing "clojure.core" "map" "map" nil) + (expect (cider-eldoc-format-thing "clojure.core" "map" "map" 'function) :to-equal "core/map") - (expect (cider-eldoc-format-thing '("java.lang.String") "" ".startsWith" nil) + (expect (cider-eldoc-format-thing '("java.lang.String") "" ".startsWith" 'function) :to-equal "String/.startsWith") - (expect (cider-eldoc-format-thing class-names "" ".length" nil) + (expect (cider-eldoc-format-thing class-names "" ".length" 'function) :to-equal "(String StringBuffer CharSequence & 1 more)/.length"))))) (describe "cider-eldoc-beginning-of-sexp" @@ -178,11 +178,10 @@ ;; when cursor is on inc, display its eldoc (search-forward "inc") (expect (cider-eldoc-info-in-current-sexp) :to-equal - '("eldoc-info" ("clojure.core" "inc" (("x"))) "thing" "inc" "pos" 1)) + '("eldoc-info" ("clojure.core" "inc" (("x"))) "thing" "inc" "pos" 0)) ;; eldoc can be nil (search-forward "1") - (expect (cider-eldoc-info-in-current-sexp) :to-equal - '("eldoc-info" nil "thing" nil "pos" 0)) + (expect (cider-eldoc-info-in-current-sexp) :to-equal nil) ;; when cursor is at the end of sexp, display eldoc of first symbol (search-forward "]") (expect (cider-eldoc-info-in-current-sexp) :to-equal @@ -203,8 +202,7 @@ '("eldoc-info" ("clojure.core" "map" (("f") ("f" "coll"))) "thing" "map" "pos" 1)) ;; eldoc can be nil (search-forward "1") - (expect (cider-eldoc-info-in-current-sexp) :to-equal - '("eldoc-info" nil "thing" nil "pos" 0)) + (expect (cider-eldoc-info-in-current-sexp) :to-equal nil) ;; when cursor is at the end of sexp, display eldoc of first symbol (search-forward "]") (expect (cider-eldoc-info-in-current-sexp) :to-equal |