Skip to content

Commit f4cd8a0

Browse files
committed
Add tests for cider-symbol-at-point
1 parent 2810703 commit f4cd8a0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/cider-util-tests.el

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,26 @@ buffer."
102102
(with-clojure-buffer "SomeRecord."
103103
(expect (cider-symbol-at-point) :to-equal "SomeRecord"))))
104104

105+
(describe "when the symbol at point is quoted"
106+
(it "returns the symbol without the preceding '"
107+
(with-clojure-buffer "'foo'bar"
108+
(expect (cider-symbol-at-point) :to-equal "foo'bar"))))
109+
110+
(describe "when point is on a keyword"
111+
(it "returns the keyword along with beginning : character"
112+
(with-clojure-buffer ":abc"
113+
(expect (cider-symbol-at-point) :to-equal ":abc"))
114+
(with-clojure-buffer ":abc/foo"
115+
(expect (cider-symbol-at-point) :to-equal ":abc/foo")))
116+
117+
(it "attempts to resolve namespaced keywords"
118+
(spy-on 'cider-sync-request:macroexpand :and-return-value ":foo.bar/abc")
119+
(with-clojure-buffer "(ns foo.bar) ::abc"
120+
(expect (cider-symbol-at-point) :to-equal ":foo.bar/abc"))
121+
(spy-on 'cider-sync-request:macroexpand :and-return-value ":clojure.string/abc")
122+
(with-clojure-buffer "(ns foo.bar (:require [clojure.string :as str])) ::str/abc"
123+
(expect (cider-symbol-at-point) :to-equal ":clojure.string/abc"))))
124+
105125
(describe "when there's nothing at point"
106126
(it "returns nil"
107127
(spy-on 'thing-at-point :and-return-value nil)

0 commit comments

Comments
 (0)