Skip to content

Commit 5f11afa

Browse files
committed
Add :faces keyword to with-php-mode-test macro
1 parent 69ab01b commit 5f11afa

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

php-mode-test.el

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ be processed."
106106
(let ((read-circle t))
107107
(read (current-buffer)))))
108108

109-
(cl-defmacro with-php-mode-test ((file &key style indent magic custom) &rest body)
109+
(cl-defmacro with-php-mode-test ((file &key style indent magic custom faces) &rest body)
110110
"Set up environment for testing `php-mode'.
111111
Execute BODY in a temporary buffer containing the contents of
112112
FILE, in `php-mode'. Optional keyword `:style' can be used to set
@@ -123,7 +123,10 @@ The test will use the PHP style by default.
123123
124124
If the `:custom' keyword is set, customized variables are not reset to
125125
their default state prior to starting the test. Use this if the test should
126-
run with specific customizations set."
126+
run with specific customizations set.
127+
128+
If the `:faces' keyword is set, read the file with `.faces' added to that
129+
file name and check that the faces of the fonts in the buffer match."
127130
(declare (indent 1))
128131
`(with-temp-buffer
129132
(insert-file-contents (expand-file-name ,file php-mode-test-dir))
@@ -147,6 +150,11 @@ run with specific customizations set."
147150
,(if magic
148151
'(should (cl-reduce (lambda (l r) (and l r))
149152
(php-mode-test-process-magics))))
153+
,(if faces
154+
`(should (equal
155+
(php-mode-test--parse-list-file
156+
(concat (expand-file-name ,file php-mode-test-dir) ".faces"))
157+
(php-mode-test--buffer-face-list (current-buffer)))))
150158
(goto-char (point-min))
151159
(let ((case-fold-search nil))
152160
,@body)))

0 commit comments

Comments
 (0)