1 ;;; test/context-coloring-test.el --- Tests for context coloring. -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2014-2015 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
7 ;; This program is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ;; Tests for context-coloring.
24 ;; Tests for both synchronous (elisp) and asynchronous (shell command) coloring
25 ;; are available. Basic plugin functionality is also tested.
27 ;; To run, execute `make test' from the project root.
34 ;;; Test running utilities
36 (defconst context-coloring-test-path
37 (file-name-directory (or load-file-name buffer-file-name))
38 "This file's directory.")
40 (defun context-coloring-test-read-file (path)
41 "Read a file's contents from PATH into a string."
43 (insert-file-contents (expand-file-name path context-coloring-test-path))
46 (defun context-coloring-test-setup ()
47 "Prepare before all tests."
48 (setq context-coloring-comments-and-strings nil))
50 (defun context-coloring-test-cleanup ()
51 "Cleanup after all tests."
52 (setq context-coloring-comments-and-strings t)
53 (setq context-coloring-after-colorize-hook nil)
54 (setq context-coloring-js-block-scopes nil))
56 (defmacro context-coloring-test-with-fixture (fixture &rest body)
57 "With the relative FIXTURE, evaluate BODY in a temporary
62 (context-coloring-test-setup)
63 (insert (context-coloring-test-read-file ,fixture))
65 (context-coloring-test-cleanup))))
67 (defun context-coloring-test-with-temp-buffer-async (callback)
68 "Create a temporary buffer, and evaluate CALLBACK there. A
69 teardown callback is passed to CALLBACK for it to invoke when it
71 (let ((temp-buffer (make-symbol "temp-buffer")))
72 (let ((previous-buffer (current-buffer))
73 (temp-buffer (generate-new-buffer " *temp*")))
74 (set-buffer temp-buffer)
78 (and (buffer-name temp-buffer)
79 (kill-buffer temp-buffer))
80 (set-buffer previous-buffer))))))
82 (defun context-coloring-test-with-fixture-async
83 (fixture callback &optional setup)
84 "With the relative FIXTURE, evaluate CALLBACK in a temporary
85 buffer. A teardown callback is passed to CALLBACK for it to
86 invoke when it is done. An optional SETUP callback can run
87 arbitrary code before the mode is invoked."
88 (context-coloring-test-with-temp-buffer-async
89 (lambda (done-with-temp-buffer)
90 (context-coloring-test-setup)
91 (when setup (funcall setup))
92 (insert (context-coloring-test-read-file fixture))
96 (context-coloring-test-cleanup)
97 (funcall done-with-temp-buffer))))))
100 ;;; Test defining utilities
102 (defun context-coloring-test-js-mode (fixture callback &optional setup)
103 "Use FIXTURE as the subject matter for test logic in CALLBACK.
104 Optionally, provide setup code to run before the mode is
105 instantiated in SETUP."
106 (context-coloring-test-with-fixture-async
108 (lambda (done-with-test)
110 (context-coloring-mode)
111 (context-coloring-colorize
113 (funcall callback done-with-test))))
116 (defmacro context-coloring-test-js2-mode (fixture &rest body)
117 "Use FIXTURE as the subject matter for test logic in BODY."
118 `(context-coloring-test-with-fixture
121 (setq js2-mode-show-parse-errors nil)
122 (setq js2-mode-show-strict-warnings nil)
124 (context-coloring-mode)
127 (defmacro context-coloring-test-deftest-js-mode (name)
128 "Define an asynchronous test for `js-mode' with the name NAME
129 in the typical format."
130 (let ((test-name (intern (format "context-coloring-test-js-mode-%s" name)))
131 (fixture (format "./fixtures/%s.js" name))
132 (function-name (intern-soft
133 (format "context-coloring-test-js-%s" name))))
134 `(ert-deftest-async ,test-name (done)
135 (context-coloring-test-js-mode
143 (defmacro context-coloring-test-deftest-js2-mode (name)
144 "Define a test for `js2-mode' with the name NAME in the typical
146 (let ((test-name (intern (format "context-coloring-test-js2-mode-%s" name)))
147 (fixture (format "./fixtures/%s.js" name))
148 (function-name (intern-soft
149 (format "context-coloring-test-js-%s" name))))
150 `(ert-deftest ,test-name ()
151 (context-coloring-test-js2-mode
156 ;;; Assertion functions
158 (defmacro context-coloring-test-assert-region (&rest body)
159 "Assert something about the face of points in a region.
160 Provides the free variables `i', `length', `point', `face' and
161 `actual-level' to the code in BODY."
163 (length (- end start)))
165 (let* ((point (+ i start))
166 (face (get-text-property point 'face))
171 (defun context-coloring-test-assert-region-level (start end level)
172 "Assert that all points in the range [START, END) are of level
174 (context-coloring-test-assert-region
175 (when (not (when face
176 (let* ((face-string (symbol-name face))
177 (matches (string-match
178 context-coloring-level-face-regexp
181 (setq actual-level (string-to-number
182 (substring face-string
185 (= level actual-level)))))
186 (ert-fail (format (concat "Expected level in region [%s, %s), "
187 "which is \"%s\", to be %s; "
188 "but at point %s, it was %s")
190 (buffer-substring-no-properties start end) level
191 point actual-level)))))
193 (defun context-coloring-test-assert-region-face (start end expected-face)
194 "Assert that all points in the range [START, END) have the face
196 (context-coloring-test-assert-region
197 (when (not (eq face expected-face))
198 (ert-fail (format (concat "Expected face in region [%s, %s), "
199 "which is \"%s\", to be %s; "
200 "but at point %s, it was %s")
202 (buffer-substring-no-properties start end) expected-face
205 (defun context-coloring-test-assert-region-comment-delimiter (start end)
206 "Assert that all points in the range [START, END) have
207 `font-lock-comment-delimiter-face'."
208 (context-coloring-test-assert-region-face
209 start end 'font-lock-comment-delimiter-face))
211 (defun context-coloring-test-assert-region-comment (start end)
212 "Assert that all points in the range [START, END) have
213 `font-lock-comment-face'."
214 (context-coloring-test-assert-region-face
215 start end 'font-lock-comment-face))
217 (defun context-coloring-test-assert-region-string (start end)
218 "Assert that all points in the range [START, END) have
219 `font-lock-string-face'."
220 (context-coloring-test-assert-region-face
221 start end 'font-lock-string-face))
223 (defun context-coloring-test-assert-message (expected buffer)
224 "Assert that message EXPECTED exists in BUFFER."
225 (when (null (get-buffer buffer))
229 "Expected buffer `%s' to have message \"%s\", "
230 "but the buffer did not have any messages.")
232 (with-current-buffer buffer
233 (let ((messages (split-string
234 (buffer-substring-no-properties
238 (let ((message (car (nthcdr (- (length messages) 2) messages))))
239 (when (not (equal message expected))
243 "Expected buffer `%s' to have message \"%s\", "
244 "but instead it was \"%s\"")
248 (defun context-coloring-test-assert-no-message (buffer)
249 "Assert that BUFFER has no message."
250 (when (get-buffer buffer)
251 (ert-fail (format (concat "Expected buffer `%s' to have no messages, "
254 (with-current-buffer buffer
257 (defun context-coloring-test-kill-buffer (buffer)
258 "Kill BUFFER if it exists."
259 (when (get-buffer buffer) (kill-buffer buffer)))
261 (defun context-coloring-test-assert-face (level foreground &optional negate)
262 "Assert that a face for LEVEL exists and that its `:foreground'
263 is FOREGROUND, or the inverse if NEGATE is non-nil."
264 (let* ((face (context-coloring-level-face level))
266 (when (not (or negate
268 (ert-fail (format (concat "Expected face for level `%s' to exist; "
271 (setq actual-foreground (face-attribute face :foreground))
272 (when (funcall (if negate 'identity 'not)
273 (string-equal foreground actual-foreground))
274 (ert-fail (format (concat "Expected face for level `%s' "
275 "%sto have foreground `%s'; "
278 (if negate "not " "") foreground
279 (if negate "did" (format "was `%s'" actual-foreground)))))))
281 (defun context-coloring-test-assert-not-face (&rest arguments)
282 "Assert that LEVEL does not have a face with `:foreground'
283 FOREGROUND. Apply ARGUMENTS to
284 `context-coloring-test-assert-face', see that function."
285 (apply 'context-coloring-test-assert-face
286 (append arguments '(t))))
291 (ert-deftest context-coloring-test-unsupported-mode ()
292 (context-coloring-test-with-fixture
293 "./fixtures/function-scopes.js"
294 (context-coloring-mode)
295 (context-coloring-test-assert-message
296 "Context coloring is not available for this major mode"
299 (defvar context-coloring-test-theme-index 0
300 "Unique index for unique theme names.")
302 (defun context-coloring-test-get-next-theme ()
303 "Return a unique symbol for a throwaway theme."
305 (intern (format "context-coloring-test-theme-%s"
306 context-coloring-test-theme-index))
307 (setq context-coloring-test-theme-index
308 (+ context-coloring-test-theme-index 1))))
310 (defun context-coloring-test-assert-theme-originally-set-p
311 (settings &optional negate)
312 "Assert that `context-coloring-theme-originally-set-p' returns
313 t for a theme with SETTINGS, or the inverse if NEGATE is
315 (let ((theme (context-coloring-test-get-next-theme)))
316 (put theme 'theme-settings settings)
317 (when (funcall (if negate 'identity 'not)
318 (context-coloring-theme-originally-set-p theme))
319 (ert-fail (format (concat "Expected theme `%s' with settings `%s' "
320 "%sto be considered to have defined a level, "
323 (if negate "not " "")
324 (if negate "was" "wasn't"))))))
326 (defun context-coloring-test-assert-not-theme-originally-set-p (&rest arguments)
327 "Assert that `context-coloring-theme-originally-set-p' does not
328 return t for a theme with SETTINGS. Apply ARGUMENTS to
329 `context-coloring-test-assert-theme-originally-set-p', see that
331 (apply 'context-coloring-test-assert-theme-originally-set-p
332 (append arguments '(t))))
334 (ert-deftest context-coloring-test-theme-originally-set-p ()
335 (context-coloring-test-assert-theme-originally-set-p
336 '((theme-face context-coloring-level-0-face)))
337 (context-coloring-test-assert-theme-originally-set-p
339 (theme-face context-coloring-level-0-face)))
340 (context-coloring-test-assert-theme-originally-set-p
341 '((theme-face context-coloring-level-0-face)
343 (context-coloring-test-assert-not-theme-originally-set-p
344 '((theme-face face)))
347 (defun context-coloring-test-assert-theme-settings-highest-level
348 (settings expected-level)
349 "Assert that a theme with SETTINGS has the highest level
351 (let ((theme (context-coloring-test-get-next-theme)))
352 (put theme 'theme-settings settings)
353 (context-coloring-test-assert-theme-highest-level theme expected-level)))
355 (defun context-coloring-test-assert-theme-highest-level
356 (theme expected-level &optional negate)
357 "Assert that THEME has the highest level EXPECTED-LEVEL, or the
358 inverse if NEGATE is non-nil."
359 (let ((highest-level (context-coloring-theme-highest-level theme)))
360 (when (funcall (if negate 'identity 'not) (eq highest-level expected-level))
361 (ert-fail (format (concat "Expected theme with settings `%s' "
362 "%sto have a highest level of `%s', "
364 (get theme 'theme-settings)
365 (if negate "not " "") expected-level
366 (if negate "did" (format "was %s" highest-level)))))))
368 (defun context-coloring-test-assert-theme-not-highest-level (&rest arguments)
369 "Assert that THEME's highest level is not EXPECTED-LEVEL.
371 `context-coloring-test-assert-theme-highest-level', see that
373 (apply 'context-coloring-test-assert-theme-highest-level
374 (append arguments '(t))))
376 (ert-deftest context-coloring-test-theme-highest-level ()
377 (context-coloring-test-assert-theme-settings-highest-level
380 (context-coloring-test-assert-theme-settings-highest-level
381 '((theme-face context-coloring-level-0-face))
383 (context-coloring-test-assert-theme-settings-highest-level
384 '((theme-face context-coloring-level-1-face))
386 (context-coloring-test-assert-theme-settings-highest-level
387 '((theme-face context-coloring-level-1-face)
388 (theme-face context-coloring-level-0-face))
390 (context-coloring-test-assert-theme-settings-highest-level
391 '((theme-face context-coloring-level-0-face)
392 (theme-face context-coloring-level-1-face))
396 (defmacro context-coloring-test-deftest-define-theme (name &rest body)
397 "Define a test with name NAME and an automatically-generated
398 theme symbol available as a free variable `theme'. Side-effects
399 from enabling themes are reversed after BODY is executed and the
401 (declare (indent defun))
402 (let ((deftest-name (intern
403 (format "context-coloring-test-define-theme-%s" name))))
404 `(ert-deftest ,deftest-name ()
405 (context-coloring-test-kill-buffer "*Warnings*")
406 (let ((theme (context-coloring-test-get-next-theme)))
411 (disable-theme theme))))))
413 (defun context-coloring-test-deftheme (theme)
414 "Dynamically define theme THEME."
415 (eval (macroexpand `(deftheme ,theme))))
417 (context-coloring-test-deftest-define-theme additive
418 (context-coloring-test-deftheme theme)
419 (context-coloring-define-theme
423 (context-coloring-test-assert-no-message "*Warnings*")
425 (context-coloring-test-assert-no-message "*Warnings*")
426 (context-coloring-test-assert-face 0 "#aaaaaa")
427 (context-coloring-test-assert-face 1 "#bbbbbb"))
429 (defun context-coloring-test-assert-defined-warning (theme)
430 "Assert that a warning about colors already being defined for
431 theme THEME is signaled."
432 (context-coloring-test-assert-message
433 (format (concat "Warning (emacs): Context coloring colors for theme "
434 "`%s' are already defined")
438 (context-coloring-test-deftest-define-theme unintentional-override
439 (context-coloring-test-deftheme theme)
440 (custom-theme-set-faces
442 '(context-coloring-level-0-face ((t (:foreground "#aaaaaa"))))
443 '(context-coloring-level-1-face ((t (:foreground "#bbbbbb")))))
444 (context-coloring-define-theme
448 (context-coloring-test-assert-defined-warning theme)
449 (context-coloring-test-kill-buffer "*Warnings*")
451 (context-coloring-test-assert-defined-warning theme)
452 (context-coloring-test-assert-face 0 "#cccccc")
453 (context-coloring-test-assert-face 1 "#dddddd"))
455 (context-coloring-test-deftest-define-theme intentional-override
456 (context-coloring-test-deftheme theme)
457 (custom-theme-set-faces
459 '(context-coloring-level-0-face ((t (:foreground "#aaaaaa"))))
460 '(context-coloring-level-1-face ((t (:foreground "#bbbbbb")))))
461 (context-coloring-define-theme
466 (context-coloring-test-assert-no-message "*Warnings*")
468 (context-coloring-test-assert-no-message "*Warnings*")
469 (context-coloring-test-assert-face 0 "#cccccc")
470 (context-coloring-test-assert-face 1 "#dddddd"))
472 (context-coloring-test-deftest-define-theme pre-recede
473 (context-coloring-define-theme
478 (context-coloring-test-deftheme theme)
479 (custom-theme-set-faces
481 '(context-coloring-level-0-face ((t (:foreground "#cccccc"))))
482 '(context-coloring-level-1-face ((t (:foreground "#dddddd")))))
484 (context-coloring-test-assert-no-message "*Warnings*")
485 (context-coloring-test-assert-face 0 "#cccccc")
486 (context-coloring-test-assert-face 1 "#dddddd"))
488 (context-coloring-test-deftest-define-theme post-recede
489 (context-coloring-test-deftheme theme)
490 (custom-theme-set-faces
492 '(context-coloring-level-0-face ((t (:foreground "#aaaaaa"))))
493 '(context-coloring-level-1-face ((t (:foreground "#bbbbbb")))))
494 (context-coloring-define-theme
499 (context-coloring-test-assert-no-message "*Warnings*")
500 (context-coloring-test-assert-face 0 "#aaaaaa")
501 (context-coloring-test-assert-face 1 "#bbbbbb")
503 (context-coloring-test-assert-no-message "*Warnings*")
504 (context-coloring-test-assert-face 0 "#aaaaaa")
505 (context-coloring-test-assert-face 1 "#bbbbbb"))
507 (context-coloring-test-deftest-define-theme recede-not-defined
508 (context-coloring-test-deftheme theme)
509 (custom-theme-set-faces
511 '(foo-face ((t (:foreground "#ffffff")))))
512 (context-coloring-define-theme
517 (context-coloring-test-assert-no-message "*Warnings*")
518 (context-coloring-test-assert-face 0 "#aaaaaa")
519 (context-coloring-test-assert-face 1 "#bbbbbb")
521 (context-coloring-test-assert-no-message "*Warnings*")
522 (context-coloring-test-assert-face 0 "#aaaaaa")
523 (context-coloring-test-assert-face 1 "#bbbbbb"))
525 (context-coloring-test-deftest-define-theme unintentional-obstinance
526 (context-coloring-define-theme
530 (context-coloring-test-deftheme theme)
531 (custom-theme-set-faces
533 '(context-coloring-level-0-face ((t (:foreground "#cccccc"))))
534 '(context-coloring-level-1-face ((t (:foreground "#dddddd")))))
536 (context-coloring-test-assert-defined-warning theme)
537 (context-coloring-test-assert-face 0 "#aaaaaa")
538 (context-coloring-test-assert-face 1 "#bbbbbb"))
540 (context-coloring-test-deftest-define-theme intentional-obstinance
541 (context-coloring-define-theme
546 (context-coloring-test-deftheme theme)
547 (custom-theme-set-faces
549 '(context-coloring-level-0-face ((t (:foreground "#cccccc"))))
550 '(context-coloring-level-1-face ((t (:foreground "#dddddd")))))
552 (context-coloring-test-assert-no-message "*Warnings*")
553 (context-coloring-test-assert-face 0 "#aaaaaa")
554 (context-coloring-test-assert-face 1 "#bbbbbb"))
556 (defun context-coloring-test-assert-maximum-face (maximum &optional negate)
557 "Assert that `context-coloring-maximum-face' is MAXIMUM, or the
558 inverse if NEGATE is non-nil."
559 (when (funcall (if negate 'identity 'not)
560 (eq context-coloring-maximum-face maximum))
561 (ert-fail (format (concat "Expected `context-coloring-maximum-face' "
564 (if negate "not " "") maximum
567 (format "was `%s'" context-coloring-maximum-face))))))
569 (defun context-coloring-test-assert-not-maximum-face (&rest arguments)
570 "Assert that `context-coloring-maximum-face' is not MAXIMUM.
571 Apply ARGUMENTS to `context-coloring-test-assert-maximum-face',
573 (apply 'context-coloring-test-assert-maximum-face
574 (append arguments '(t))))
576 (context-coloring-test-deftest-define-theme disable-cascade
577 (context-coloring-test-deftheme theme)
578 (context-coloring-define-theme
582 (let ((second-theme (context-coloring-test-get-next-theme)))
583 (context-coloring-test-deftheme second-theme)
584 (context-coloring-define-theme
589 (let ((third-theme (context-coloring-test-get-next-theme)))
590 (context-coloring-test-deftheme third-theme)
591 (context-coloring-define-theme
598 (enable-theme second-theme)
599 (enable-theme third-theme)
600 (disable-theme third-theme)
601 (context-coloring-test-assert-face 0 "#cccccc")
602 (context-coloring-test-assert-face 1 "#dddddd")
603 (context-coloring-test-assert-face 2 "#eeeeee")
604 (context-coloring-test-assert-maximum-face 2))
605 (disable-theme second-theme)
606 (context-coloring-test-assert-face 0 "#aaaaaa")
607 (context-coloring-test-assert-face 1 "#bbbbbb")
608 (context-coloring-test-assert-maximum-face 1))
609 (disable-theme theme)
610 (context-coloring-test-assert-not-face 0 "#aaaaaa")
611 (context-coloring-test-assert-not-face 1 "#bbbbbb")
612 (context-coloring-test-assert-not-maximum-face 1))
614 (defun context-coloring-test-js-function-scopes ()
615 "Test fixtures/functions-scopes.js."
616 (context-coloring-test-assert-region-level 1 9 0)
617 (context-coloring-test-assert-region-level 9 23 1)
618 (context-coloring-test-assert-region-level 23 25 0)
619 (context-coloring-test-assert-region-level 25 34 1)
620 (context-coloring-test-assert-region-level 34 35 0)
621 (context-coloring-test-assert-region-level 35 52 1)
622 (context-coloring-test-assert-region-level 52 66 2)
623 (context-coloring-test-assert-region-level 66 72 1)
624 (context-coloring-test-assert-region-level 72 81 2)
625 (context-coloring-test-assert-region-level 81 82 1)
626 (context-coloring-test-assert-region-level 82 87 2)
627 (context-coloring-test-assert-region-level 87 89 1))
629 (context-coloring-test-deftest-js-mode function-scopes)
630 (context-coloring-test-deftest-js2-mode function-scopes)
632 (defun context-coloring-test-js-global ()
633 "Test fixtures/global.js."
634 (context-coloring-test-assert-region-level 20 28 1)
635 (context-coloring-test-assert-region-level 28 35 0)
636 (context-coloring-test-assert-region-level 35 41 1))
638 (context-coloring-test-deftest-js-mode global)
639 (context-coloring-test-deftest-js2-mode global)
641 (defun context-coloring-test-js-block-scopes ()
642 "Test fixtures/block-scopes.js."
643 (context-coloring-test-assert-region-level 20 64 1)
644 (setq context-coloring-js-block-scopes t)
645 (context-coloring-colorize)
646 (context-coloring-test-assert-region-level 20 27 1)
647 (context-coloring-test-assert-region-level 27 41 2)
648 (context-coloring-test-assert-region-level 41 42 1)
649 (context-coloring-test-assert-region-level 42 64 2))
651 (context-coloring-test-deftest-js2-mode block-scopes)
653 (defun context-coloring-test-js-catch ()
654 "Test fixtures/js-catch.js."
655 (context-coloring-test-assert-region-level 20 27 1)
656 (context-coloring-test-assert-region-level 27 51 2)
657 (context-coloring-test-assert-region-level 51 52 1)
658 (context-coloring-test-assert-region-level 52 73 2)
659 (context-coloring-test-assert-region-level 73 101 3)
660 (context-coloring-test-assert-region-level 101 102 1)
661 (context-coloring-test-assert-region-level 102 117 3)
662 (context-coloring-test-assert-region-level 117 123 2))
664 (context-coloring-test-deftest-js-mode catch)
665 (context-coloring-test-deftest-js2-mode catch)
667 (defun context-coloring-test-js-key-names ()
668 "Test fixtures/key-names.js."
669 (context-coloring-test-assert-region-level 20 63 1))
671 (context-coloring-test-deftest-js-mode key-names)
672 (context-coloring-test-deftest-js2-mode key-names)
674 (defun context-coloring-test-js-property-lookup ()
675 "Test fixtures/property-lookup.js."
676 (context-coloring-test-assert-region-level 20 26 0)
677 (context-coloring-test-assert-region-level 26 38 1)
678 (context-coloring-test-assert-region-level 38 44 0)
679 (context-coloring-test-assert-region-level 44 52 1)
680 (context-coloring-test-assert-region-level 57 63 0)
681 (context-coloring-test-assert-region-level 63 74 1))
683 (context-coloring-test-deftest-js-mode property-lookup)
684 (context-coloring-test-deftest-js2-mode property-lookup)
686 (defun context-coloring-test-js-key-values ()
687 "Test fixtures/key-values.js."
688 (context-coloring-test-assert-region-level 78 79 1))
690 (context-coloring-test-deftest-js-mode key-values)
691 (context-coloring-test-deftest-js2-mode key-values)
693 (defun context-coloring-test-js-comments-and-strings ()
694 "Test fixtures/comments-and-strings.js."
695 (context-coloring-test-assert-region-comment-delimiter 1 4)
696 (context-coloring-test-assert-region-comment 4 8)
697 (context-coloring-test-assert-region-comment-delimiter 9 12)
698 (context-coloring-test-assert-region-comment 12 19)
699 (context-coloring-test-assert-region-string 20 32)
700 (context-coloring-test-assert-region-level 32 33 0))
702 (ert-deftest-async context-coloring-test-js-mode-comments-and-strings (done)
703 (context-coloring-test-js-mode
704 "./fixtures/comments-and-strings.js"
707 (context-coloring-test-js-comments-and-strings)
711 (setq context-coloring-comments-and-strings t))))
713 (ert-deftest context-coloring-test-js2-mode-comments-and-strings ()
714 (context-coloring-test-js2-mode
715 "./fixtures/comments-and-strings.js"
716 (setq context-coloring-comments-and-strings t)
717 (context-coloring-colorize)
718 (context-coloring-test-js-comments-and-strings)))
720 (provide 'context-coloring-test)
722 ;;; context-coloring-test.el ends here