]> git.eshelyaron.com Git - emacs.git/commitdiff
Add derived-mode test for bug#24176
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 24 Jan 2022 14:10:18 +0000 (15:10 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 24 Jan 2022 14:10:18 +0000 (15:10 +0100)
test/lisp/emacs-lisp/derived-tests.el

index d867a181832928e18631f9f9a9e2fef080442f6c..0589819ccc154dd02005be907b911b696dfcf7e8 100644 (file)
       (derived-tests--child-mode)
       (should (equal (buffer-string) "PB CB MH AFP=S AFC=S ")))))
 
+(ert-deftest test-add-font-lock ()
+  (define-derived-mode mode-a fundamental-mode "mode-a"
+    (font-lock-add-keywords nil `(("a" 0 'font-lock-keyword-face))))
+  (define-derived-mode mode-b mode-a "mode-b"
+    (font-lock-add-keywords nil `(("b" 0 'font-lock-builtin-face))))
+  (define-derived-mode mode-c mode-b "mode-c"
+    (font-lock-add-keywords nil `(("c" 0 'font-lock-constant-face))))
+
+  (with-temp-buffer
+    (mode-c)
+    (should (equal font-lock-keywords
+                   '(t (("c" 0 'font-lock-constant-face)
+                        ("b" 0 'font-lock-builtin-face)
+                        ("a" 0 'font-lock-keyword-face))
+                       ("c" (0 'font-lock-constant-face))
+                       ("b" (0 'font-lock-builtin-face))
+                       ("a" (0 'font-lock-keyword-face)))))))
+
 ;;; derived-tests.el ends here