diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-15 21:40:54 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-15 21:40:54 -0500 |
| commit | 79a38fe13bed9c9824ff4eb943de22da69b09b7f (patch) | |
| tree | a84dd70429bc86d3fea3bf15d20cbde3cc3ff567 /tests | |
| parent | cd95ea79d004ca874dcc17dc2334f25efdb1bf9a (diff) | |
| download | dotemacs-79a38fe13bed9c9824ff4eb943de22da69b09b7f.tar.gz dotemacs-79a38fe13bed9c9824ff4eb943de22da69b09b7f.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.el | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test-system-defaults.el b/tests/test-system-defaults.el index 3c5e59777..928124f56 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 () |
