From: Lars Ingebrigtsen Date: Mon, 24 Jan 2022 14:10:18 +0000 (+0100) Subject: Add derived-mode test for bug#24176 X-Git-Tag: emacs-29.0.90~2790 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=79d9f3982fe6e558327584099f2efc96e51485a1;p=emacs.git Add derived-mode test for bug#24176 --- diff --git a/test/lisp/emacs-lisp/derived-tests.el b/test/lisp/emacs-lisp/derived-tests.el index d867a181832..0589819ccc1 100644 --- a/test/lisp/emacs-lisp/derived-tests.el +++ b/test/lisp/emacs-lisp/derived-tests.el @@ -40,4 +40,22 @@ (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