]> code.delx.au - gnu-emacs-elpa/blobdiff - test/context-coloring-test.el
Suppress unavailable messages in minibuffer.
[gnu-emacs-elpa] / test / context-coloring-test.el
index 942d9889f9c87fde66e56e00e946f754b525a7c8..f5633b86e682cd750e797b6d573c2d7a35bb67ee 100644 (file)
@@ -44,8 +44,7 @@
     (buffer-string)))
 
 (defmacro context-coloring-test-with-fixture (fixture &rest body)
-  "With the relative FIXTURE, evaluate BODY in a temporary
-buffer."
+  "With relative FIXTURE, evaluate BODY in a temporary buffer."
   `(with-temp-buffer
      (progn
        (insert (context-coloring-test-read-file ,fixture))
@@ -199,8 +198,7 @@ signaled."
     `(define-derived-mode ,name fundamental-mode "Testing")))
 
 (defvar context-coloring-test-caused-p nil
-  "Dumb flag tracking for lambdas inside old advice definitions
-which don't seem to have lexical binding.")
+  "If non-nil, coloring was caused.")
 
 (defmacro context-coloring-test-assert-causes-coloring (&rest body)
   "Assert that BODY causes coloring."
@@ -219,6 +217,7 @@ which don't seem to have lexical binding.")
        (ert-fail "Expected to have colorized, but it didn't."))))
 
 (defun context-coloring-test-cleanup-assert-causes-coloring ()
+  "Undo `context-coloring-test-assert-causes-coloring'."
   (ad-unadvise #'context-coloring-colorize)
   (setq context-coloring-test-caused-p nil))
 
@@ -260,7 +259,7 @@ which don't seem to have lexical binding.")
   (lambda ()
     (context-coloring-mode)
     (context-coloring-test-assert-message
-     "Context coloring is not available for this major mode"
+     "Context coloring is unavailable here"
      "*Messages*")))
 
 (context-coloring-test-deftest derived-mode
@@ -268,9 +267,22 @@ which don't seem to have lexical binding.")
     (lisp-interaction-mode)
     (context-coloring-mode)
     (context-coloring-test-assert-not-message
-     "Context coloring is not available for this major mode"
+     "Context coloring is unavailable here"
      "*Messages*")))
 
+(context-coloring-test-deftest unavailable-message-ignored
+  (lambda ()
+    (minibuffer-with-setup-hook
+        (lambda ()
+          (context-coloring-mode)
+          (context-coloring-test-assert-not-message
+           "Context coloring is unavailable here"
+           "*Messages*"))
+      (execute-kbd-macro
+       (vconcat
+        [?\C-u]
+        [?\M-!])))))
+
 (context-coloring-test-define-derived-mode define-dispatch-error)
 
 (context-coloring-test-deftest define-dispatch-error