emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e5aaa12: Add some elisp-mode font lock tests


From: Lars Ingebrigtsen
Subject: master e5aaa12: Add some elisp-mode font lock tests
Date: Sun, 24 Jan 2021 14:53:51 -0500 (EST)

branch: master
commit e5aaa1251cfb9d6d18682a5eda137a2e12ca4213
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Add some elisp-mode font lock tests
---
 test/lisp/progmodes/elisp-mode-tests.el | 51 +++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/test/lisp/progmodes/elisp-mode-tests.el 
b/test/lisp/progmodes/elisp-mode-tests.el
index fd43707..0da0e39 100644
--- a/test/lisp/progmodes/elisp-mode-tests.el
+++ b/test/lisp/progmodes/elisp-mode-tests.el
@@ -834,5 +834,56 @@ to (xref-elisp-test-descr-to-target xref)."
       (indent-region (point-min) (point-max))
       (should (equal (buffer-string) orig)))))
 
+(defun test--font (form search)
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (if (stringp form)
+        (insert form)
+      (pp form (current-buffer)))
+    (font-lock-debug-fontify)
+    (goto-char (point-min))
+    (and (re-search-forward search nil t)
+         (get-text-property (match-beginning 1) 'face))))
+
+(ert-deftest test-elisp-font-keywords-1 ()
+  ;; Special form.
+  (should (eq (test--font '(if foo bar) "(\\(if\\)")
+              'font-lock-keyword-face))
+  ;; Macro.
+  (should (eq (test--font '(when foo bar) "(\\(when\\)")
+              'font-lock-keyword-face))
+  (should (eq (test--font '(condition-case nil
+                               (foo)
+                             (error (if a b)))
+                          "(\\(if\\)")
+              'font-lock-keyword-face))
+  (should (eq (test--font '(condition-case nil
+                               (foo)
+                             (when (if a b)))
+                          "(\\(when\\)")
+              'nil)))
+
+(ert-deftest test-elisp-font-keywords-2 ()
+  :expected-result :failed ; FIXME bug#43265
+  (should (eq (test--font '(condition-case nil
+                               (foo)
+                             (error (when a b)))
+                          "(\\(when\\)")
+              'font-lock-keyword-face)))
+
+(ert-deftest test-elisp-font-keywords-3 ()
+  :expected-result :failed ; FIXME bug#43265
+  (should (eq (test--font '(setq a '(if when zot))
+                          "(\\(if\\)")
+              nil)))
+
+(ert-deftest test-elisp-font-keywords-if ()
+  :expected-result :failed ; FIXME bug#43265
+  (should (eq (test--font '(condition-case nil
+                               (foo)
+                             ((if foo) (when a b)))
+                          "(\\(if\\)")
+              nil)))
+
 (provide 'elisp-mode-tests)
 ;;; elisp-mode-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]