aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-13 15:25:49 -0500
committerCraig Jennings <c@cjennings.net>2026-06-13 15:25:49 -0500
commit20b251981bf01dbb25f494206de046023648252f (patch)
treeb77b177db595e4b22357cc14ad640c90ecde47a7 /tests
parent22c1e2816a9100e7fcb1e8a205efec727d68fcb9 (diff)
downloaddotemacs-20b251981bf01dbb25f494206de046023648252f.tar.gz
dotemacs-20b251981bf01dbb25f494206de046023648252f.zip
fix(help-config): non-destructive info open, clean cancel, drop dead config
Three audit defects in one file. cj/open-with-info-mode used cl-return-from inside a plain defun, so declining the save prompt threw "No catch for tag" instead of cancelling. The decision is now a pure cj/--info-open-plan and the command routes through it. A dead :hook (info-mode . info-persist-history-mode, which names a non-existent mode on the wrong hook) and an empty :preface are gone. The auto-mode-alist entry that mapped .info to that interactive, buffer-killing command is dropped, so find-file-noselect of a .info no longer destroys buffers. cj/open-with-info-mode stays an M-x command and C-h i still browses info files.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-help-config.el32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test-help-config.el b/tests/test-help-config.el
new file mode 100644
index 00000000..0ba95c41
--- /dev/null
+++ b/tests/test-help-config.el
@@ -0,0 +1,32 @@
+;;; test-help-config.el --- Tests for the Info-open decision logic -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; cj/open-with-info-mode opens the current .info buffer in Info, prompting to
+;; save first if the buffer is modified. The save/cancel/open decision is
+;; factored into the pure helper `cj/--info-open-plan' so it's testable without
+;; driving find-file, Info, or the save prompt. Declining the prompt must yield
+;; `cancel' -- the original cl-return-from inside a plain defun signalled
+;; "No catch for tag" instead of cancelling.
+
+;;; Code:
+
+(require 'ert)
+
+(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
+(require 'help-config)
+
+(ert-deftest test-info-open-plan-unmodified-opens ()
+ "Normal: an unmodified buffer opens in Info directly."
+ (should (eq (cj/--info-open-plan nil nil) 'open)))
+
+(ert-deftest test-info-open-plan-modified-confirmed-saves-then-opens ()
+ "Normal: a modified buffer whose save is confirmed saves, then opens."
+ (should (eq (cj/--info-open-plan t t) 'save-then-open)))
+
+(ert-deftest test-info-open-plan-modified-declined-cancels ()
+ "Error/edge: a modified buffer whose save is declined cancels -- the path that
+used to signal \"No catch for tag\" via cl-return-from in a plain defun."
+ (should (eq (cj/--info-open-plan t nil) 'cancel)))
+
+(provide 'test-help-config)
+;;; test-help-config.el ends here