From 3c64dac1b98049d475be838294349326c32248ae Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 10 May 2026 16:36:47 -0500 Subject: feat: tighten chime runtime validation and tooltip behavior --- tests/test-chime-debug-functions.el | 39 ++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'tests/test-chime-debug-functions.el') diff --git a/tests/test-chime-debug-functions.el b/tests/test-chime-debug-functions.el index a01fd5f..7ef85e5 100644 --- a/tests/test-chime-debug-functions.el +++ b/tests/test-chime-debug-functions.el @@ -26,6 +26,7 @@ ;;; Code: (setq chime-debug t) +(require 'cl-lib) (require 'test-bootstrap (expand-file-name "test-bootstrap.el")) (require 'chime-debug (expand-file-name "../chime-debug.el")) @@ -46,6 +47,13 @@ (chime-delete-test-base-dir) (setq chime--upcoming-events nil)) +(defmacro test-chime-debug-functions--without-echo (&rest body) + "Run BODY while preserving debug logs without echoing messages." + `(cl-letf (((symbol-function 'message) + (lambda (format-string &rest args) + (apply #'chime--log-silently format-string args)))) + ,@body)) + ;;; Tests for chime-debug-dump-events (ert-deftest test-chime-debug-dump-events-normal-with-events () @@ -67,7 +75,8 @@ (let ((inhibit-read-only t)) (erase-buffer))) ;; Call debug function - (chime-debug-dump-events) + (test-chime-debug-functions--without-echo + (chime-debug-dump-events)) ;; Verify output in *Messages* buffer (with-current-buffer "*Messages*" (let ((content (buffer-string))) @@ -85,7 +94,10 @@ (setq chime--upcoming-events nil) ;; Should not error (should-not (condition-case nil - (progn (chime-debug-dump-events) nil) + (progn + (test-chime-debug-functions--without-echo + (chime-debug-dump-events)) + nil) (error t)))) (test-chime-debug-functions-teardown))) @@ -110,7 +122,8 @@ (let ((inhibit-read-only t)) (erase-buffer))) ;; Call debug function - (chime-debug-dump-tooltip) + (test-chime-debug-functions--without-echo + (chime-debug-dump-tooltip)) ;; Verify output in *Messages* buffer (with-current-buffer "*Messages*" (let ((content (buffer-string))) @@ -128,7 +141,10 @@ (setq chime--upcoming-events nil) ;; Should not error (should-not (condition-case nil - (progn (chime-debug-dump-tooltip) nil) + (progn + (test-chime-debug-functions--without-echo + (chime-debug-dump-tooltip)) + nil) (error t)))) (test-chime-debug-functions-teardown))) @@ -147,7 +163,8 @@ (let ((inhibit-read-only t)) (erase-buffer))) ;; Call debug function - (chime-debug-config) + (test-chime-debug-functions--without-echo + (chime-debug-config)) ;; Verify output in *Messages* buffer (with-current-buffer "*Messages*" (let ((content (buffer-string))) @@ -171,7 +188,10 @@ (erase-buffer))) ;; Should not error (should-not (condition-case nil - (progn (chime-debug-config) nil) + (progn + (test-chime-debug-functions--without-echo + (chime-debug-config)) + nil) (error t))) ;; Verify output mentions 0 files (with-current-buffer "*Messages*" @@ -200,9 +220,10 @@ ;; Call all three debug functions - should not error (should-not (condition-case nil (progn - (chime-debug-dump-events) - (chime-debug-dump-tooltip) - (chime-debug-config) + (test-chime-debug-functions--without-echo + (chime-debug-dump-events) + (chime-debug-dump-tooltip) + (chime-debug-config)) nil) (error t)))))) (test-chime-debug-functions-teardown))) -- cgit v1.2.3