Skip to content

Commit 3727873

Browse files
OknoLombardaVadim Rodionov
andauthored
[Fix #625] Fix imenu displaying metadata instead of var name (#626)
Fix metadata being captured instead of var name in clojure-match-next-def. Co-authored-by: Vadim Rodionov <[email protected]>
1 parent aae566e commit 3727873

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

clojure-mode-syntax-test.el

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,31 @@
8989
(with-clojure-buffer (concat form some-sexp)
9090
(end-of-buffer)
9191
(clojure-match-next-def)
92-
(expect (looking-at "(def")))))))
92+
(expect (looking-at "(def"))))))
93+
94+
(it "captures var name"
95+
(let ((var-name "some-name"))
96+
(dolist (form '("(def %s 1)"
97+
"(def %s)"
98+
"(def ^:private %s 2)"
99+
"(def ^{:private true} %s 3)"))
100+
(with-clojure-buffer (format form var-name)
101+
(end-of-buffer)
102+
(clojure-match-next-def)
103+
(cl-destructuring-bind (name-beg name-end) (match-data)
104+
(expect (string= var-name (buffer-substring name-beg name-end))))))))
105+
106+
(it "captures var name with dispatch value for defmethod"
107+
(let ((name "some-name :key"))
108+
(dolist (form '("(defmethod %s [a])"
109+
"(defmethod ^:meta %s [a])"
110+
"(defmethod ^{:meta true} %s [a])"
111+
"(defmethod %s)"))
112+
(with-clojure-buffer (format form name)
113+
(end-of-buffer)
114+
(clojure-match-next-def)
115+
(cl-destructuring-bind (name-beg name-end) (match-data)
116+
(expect (string= name (buffer-substring name-beg name-end)))))))))
93117

94118
(describe "clojure syntax"
95119
(it "handles prefixed symbols"

0 commit comments

Comments
 (0)