]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/context-coloring/test/context-coloring-test.el
Merge commit '294b5117b42d2622f4fb0a1da219d45d98566b6e' from context-coloring
[gnu-emacs-elpa] / packages / context-coloring / test / context-coloring-test.el
index 702058924d26d8ec75ec0bf33b5e8642e2473b7c..39f2f801c1627624f82f624ca3e30a9a3fa723ac 100644 (file)
@@ -234,6 +234,10 @@ ARGS)."
   :extension "el"
   :enable-context-coloring-mode t)
 
+(context-coloring-test-define-deftest eval-expression
+  :mode #'fundamental-mode
+  :no-fixture t)
+
 (context-coloring-test-define-deftest define-theme
   :mode #'fundamental-mode
   :no-fixture t
@@ -410,7 +414,7 @@ ARGS)."
      (lambda ()
        (context-coloring-define-dispatch
         'define-dispatch-no-modes))
-     "No mode defined for dispatch")
+     "No mode or predicate defined for dispatch")
     (context-coloring-test-assert-error
      (lambda ()
        (context-coloring-define-dispatch
@@ -1268,6 +1272,24 @@ nnnnn n nnn nnnnnnnn")))
 1111 111
 nnnn nn")))
 
+(context-coloring-test-deftest-eval-expression let
+  (lambda ()
+    (minibuffer-with-setup-hook
+        (lambda ()
+          ;; Perform the test in a hook as it's the only way I know of examining
+          ;; the minibuffer's contents.  The contents are implicitly submitted,
+          ;; so we have to ignore the errors in the arbitrary test subject code.
+          (insert "(ignore-errors (let (a) (message a free)))")
+          (context-coloring-colorize)
+          (context-coloring-test-assert-coloring "
+xxxx: 0000000-000000 1111 111 11111111 1 0000110"))
+      ;; Simulate user input because `call-interactively' is blocking and
+      ;; doesn't seem to run the hook.
+      (execute-kbd-macro
+       (vconcat
+        [?\C-u] ;; Don't output the result of the arbitrary test subject code.
+        [?\M-:])))))
+
 (provide 'context-coloring-test)
 
 ;;; context-coloring-test.el ends here