Skip to content

Commit 49844a0

Browse files
kommenbbatsov
authored andcommittedOct 27, 2024·
Add font lock tests for def and defn with metadata
1 parent f4d0a9f commit 49844a0

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed
 

‎test/clojure-ts-mode-font-lock-test.el

+26-10
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,19 @@ DESCRIPTION is the description of the spec."
8787
("(defrecord a [b c])" (2 10 font-lock-keyword-face))
8888
("(deftype a [b c])" (2 8 font-lock-keyword-face))
8989
("(defstruct a :b :c)" (2 10 font-lock-keyword-face))
90-
("(deftest a (is (= 1 1)))" (2 8 font-lock-keyword-face)))
90+
("(deftest a (is (= 1 1)))" (2 8 font-lock-keyword-face))
91+
92+
93+
;; TODO: copied from clojure-mode, but failing
94+
;; ("(defne [x y])" (2 6 font-lock-keyword-face))
95+
;; ("(defnm a b)" (2 6 font-lock-keyword-face))
96+
;; ("(defnu)" (2 6 font-lock-keyword-face))
97+
;; ("(defnc [a])" (2 6 font-lock-keyword-face))
98+
;; ("(defna)" (2 6 font-lock-keyword-face))
99+
;; ("(deftask a)" (2 8 font-lock-keyword-face))
100+
;; ("(defstate a :start \"b\" :stop \"c\")" (2 9 font-lock-keyword-face))
101+
102+
)
91103

92104
(when-fontifying-it "variable-def-string-with-docstring"
93105
("(def foo \"usage\" \"hello\")"
@@ -112,12 +124,16 @@ DESCRIPTION is the description of the spec."
112124
(25 26 font-lock-string-face)
113125
(27 46 font-lock-string-face)))
114126

115-
;; TODO: copied from clojure-mode, but failing
116-
;; ("(defne [x y])" (2 6 font-lock-keyword-face))
117-
;; ("(defnm a b)" (2 6 font-lock-keyword-face))
118-
;; ("(defnu)" (2 6 font-lock-keyword-face))
119-
;; ("(defnc [a])" (2 6 font-lock-keyword-face))
120-
;; ("(defna)" (2 6 font-lock-keyword-face))
121-
;; ("(deftask a)" (2 8 font-lock-keyword-face))
122-
;; ("(defstate a :start \"b\" :stop \"c\")" (2 9 font-lock-keyword-face))
123-
)
127+
(when-fontifying-it "variable-def-with-metadata-and-docstring"
128+
("^{:foo bar}(def foo \n \"usage\" \n \"hello\")"
129+
(13 15 font-lock-keyword-face)
130+
(17 19 font-lock-variable-name-face)
131+
(24 30 font-lock-doc-face)
132+
(35 41 font-lock-string-face)))
133+
134+
(when-fontifying-it "defn-with-metadata-and-docstring"
135+
("^{:foo bar}(defn foo \n \"usage\" \n [] \n \"hello\")"
136+
(13 16 font-lock-keyword-face)
137+
(18 20 font-lock-function-name-face)
138+
(25 31 font-lock-doc-face)
139+
(40 46 font-lock-string-face))))

0 commit comments

Comments
 (0)
Please sign in to comment.