41
41
(goto-char (point-min ))
42
42
,@body ))
43
43
44
+ (defmacro clojurex-test-with-temp-buffer (content &rest body )
45
+ " Evaluate BODY in a temporary buffer with CONTENTS."
46
+ (declare (debug t )
47
+ (indent 1 ))
48
+ `(with-temp-buffer
49
+ (insert , content )
50
+ (clojurex-mode)
51
+ (font-lock-fontify-buffer )
52
+ (goto-char (point-min ))
53
+ ,@body ))
54
+
44
55
(defun clojure-get-face-at-range (start end )
45
56
(let ((start-face (get-text-property start 'face ))
46
57
(all-faces (cl-loop for i from start to end collect (get-text-property i 'face ))))
@@ -58,6 +69,16 @@ buffer."
58
69
(clojure-get-face-at-range start end))
59
70
(clojure-get-face-at-range start end)))
60
71
72
+ (defun clojurex-test-face-at (start end &optional content )
73
+ " Get the face between START and END in CONTENT.
74
+
75
+ If CONTENT is not given, return the face at the specified range in the current
76
+ buffer."
77
+ (if content
78
+ (clojurex-test-with-temp-buffer content
79
+ (clojure-get-face-at-range start end))
80
+ (clojure-get-face-at-range start end)))
81
+
61
82
(defconst clojure-test-syntax-classes
62
83
[whitespace punctuation word symbol open-paren close-paren expression-prefix
63
84
string-quote paired-delim escape character-quote comment-start
@@ -209,10 +230,10 @@ POS."
209
230
(should (eq (clojure-test-face-at 1 2 " \\ ," ) 'clojure-character-face ))
210
231
(should (eq (clojure-test-face-at 1 2 " \\ ;" ) 'clojure-character-face )))
211
232
212
- (ert-deftest clojure -mode-syntax-table/cljx ()
233
+ (ert-deftest clojurex -mode-syntax-table/cljx ()
213
234
:tags '(fontification syntax-table)
214
- (should (eq (clojure -test-face-at 1 5 " #+clj x" ) 'font-lock-preprocessor-face ))
215
- (should (eq (clojure -test-face-at 1 6 " #+cljs x" ) 'font-lock-preprocessor-face )))
235
+ (should (eq (clojurex -test-face-at 1 5 " #+clj x" ) 'font-lock-preprocessor-face ))
236
+ (should (eq (clojurex -test-face-at 1 6 " #+cljs x" ) 'font-lock-preprocessor-face )))
216
237
217
238
(ert-deftest clojure-mode-syntax-table/refer-ns ()
218
239
:tags '(fontification syntax-table)
0 commit comments