aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-15 21:40:54 -0500
committerCraig Jennings <c@cjennings.net>2026-06-15 21:40:54 -0500
commit3461586faf1b1846b66ee5cd7cb4e13e32fe56e9 (patch)
tree019486ec2f858a33743f5e2757c31afcdc8bcb7e /tests
parente624685cac9b0eae67c000a8c6e3f5fe98fad139 (diff)
downloaddotemacs-3461586faf1b1846b66ee5cd7cb4e13e32fe56e9.tar.gz
dotemacs-3461586faf1b1846b66ee5cd7cb4e13e32fe56e9.zip
fix(system-defaults): guard server-start and custom-file against batch
A raw module load under --batch started a server and dropped a throwaway custom-file temp on every run; the suite only passed because a testutil stubbed the server. Guard both with (unless noninteractive ...), the established pattern here. Adds a batch-load test for the custom-file guard.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-system-defaults.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test-system-defaults.el b/tests/test-system-defaults.el
index 3c5e5977..928124f5 100644
--- a/tests/test-system-defaults.el
+++ b/tests/test-system-defaults.el
@@ -24,7 +24,10 @@
"Normal: custom-file points at a throwaway temp file, never the repo.
This is what stops accidental Customize writes from landing in tracked init."
(test-system-defaults--with-load-environment
- (let ((custom-file nil))
+ ;; noninteractive is t under ERT batch; bind it nil so the interactive
+ ;; redirect runs (the module guards the redirect to interactive sessions).
+ (let ((custom-file nil)
+ (noninteractive nil))
(test-system-defaults--load)
(should (stringp custom-file))
(should (string-prefix-p (file-name-as-directory
@@ -35,6 +38,15 @@ This is what stops accidental Customize writes from landing in tracked init."
(should-not (string-prefix-p (expand-file-name user-emacs-directory)
(expand-file-name custom-file))))))
+(ert-deftest test-system-defaults-custom-file-not-littered-in-batch ()
+ "Boundary: a noninteractive (batch) load does not create a trashbin custom-file.
+Guards make validate-modules / byte-compile from dropping a temp file per run."
+ (test-system-defaults--with-load-environment
+ (let ((custom-file nil)
+ (noninteractive t))
+ (test-system-defaults--load)
+ (should-not custom-file))))
+
;;; backup directory
(ert-deftest test-system-defaults-backups-redirected-under-user-emacs-dir ()