aboutsummaryrefslogtreecommitdiff
path: root/tests/test-system-defaults-vc-follow-symlinks.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-25 17:00:15 -0500
committerCraig Jennings <c@cjennings.net>2026-05-25 17:00:15 -0500
commitc83b13ea891d034190b7b8582ce45f2bfaf84f40 (patch)
tree24eaf61c32566673af4acad04c42706379c9580f /tests/test-system-defaults-vc-follow-symlinks.el
parent9aa180ea57f79f79c156a0956677e13c5263b478 (diff)
downloaddotemacs-c83b13ea891d034190b7b8582ce45f2bfaf84f40.tar.gz
dotemacs-c83b13ea891d034190b7b8582ce45f2bfaf84f40.zip
test(system-defaults): cover custom-file, backups, and GC-hook registration
system-defaults.el had no coverage for its settings, only its functions (in test-system-defaults-functions.el) and the vc-follow-symlinks default. I added three settings smoke tests: custom-file is redirected to a temp trashbin rather than the repo, backups land under user-emacs-directory/backups, and the minibuffer GC hooks are actually wired onto the minibuffer hooks. I pulled the sandbox loader the vc-follow-symlinks test had inline into tests/testutil-system-defaults.el so both files share one copy. The backups test clears cj/backup-directory before loading — it's a defvar, so once an earlier test loads the module it keeps that first sandbox path and won't recompute, which made the assertion fail until I forced the recompute.
Diffstat (limited to 'tests/test-system-defaults-vc-follow-symlinks.el')
-rw-r--r--tests/test-system-defaults-vc-follow-symlinks.el54
1 files changed, 5 insertions, 49 deletions
diff --git a/tests/test-system-defaults-vc-follow-symlinks.el b/tests/test-system-defaults-vc-follow-symlinks.el
index 34406986..e8966d7b 100644
--- a/tests/test-system-defaults-vc-follow-symlinks.el
+++ b/tests/test-system-defaults-vc-follow-symlinks.el
@@ -7,60 +7,16 @@
;;; Code:
-(require 'cl-lib)
-(require 'autorevert)
-(require 'bookmark)
(require 'ert)
-(require 'server)
-(require 'vc-hooks)
-
-(defvar org-dir nil
- "Test binding for system-defaults bookmark path setup.")
-
-(defvar user-home-dir nil
- "Test binding for system-defaults default directory setup.")
-
-(defvar use-package-always-ensure nil
- "Test binding for use-package package installation policy.")
-
-(defconst test-system-defaults--repo-root
- (file-name-directory
- (directory-file-name
- (file-name-directory (or load-file-name buffer-file-name))))
- "Repository root for system-defaults tests.")
-
-(defmacro test-system-defaults--with-load-environment (&rest body)
- "Run BODY with side effects from system-defaults.el stubbed."
- `(let ((user-emacs-directory (file-name-as-directory
- (make-temp-file "system-defaults-emacs-" t)))
- (user-home-dir (file-name-as-directory
- (make-temp-file "system-defaults-home-" t)))
- (org-dir (file-name-as-directory
- (make-temp-file "system-defaults-org-" t)))
- (use-package-always-ensure nil))
- (cl-letf (((symbol-function 'server-running-p) (lambda (&rest _) t))
- ((symbol-function 'server-start) #'ignore)
- ((symbol-function 'set-locale-environment) #'ignore)
- ((symbol-function 'prefer-coding-system) #'ignore)
- ((symbol-function 'set-default-coding-systems) #'ignore)
- ((symbol-function 'set-terminal-coding-system) #'ignore)
- ((symbol-function 'set-keyboard-coding-system) #'ignore)
- ((symbol-function 'set-selection-coding-system) #'ignore)
- ((symbol-function 'set-charset-priority) #'ignore)
- ((symbol-function 'global-auto-revert-mode) #'ignore)
- ((symbol-function 'recentf-mode) #'ignore))
- (unless (fboundp 'use-package)
- (defmacro use-package (&rest _args) nil))
- ,@body)))
+(add-to-list 'load-path (expand-file-name "tests" user-emacs-directory))
+(require 'testutil-system-defaults)
(ert-deftest test-system-defaults-vc-follow-symlinks-normal-sets-t ()
"Normal: system-defaults follows version-controlled symlinks without asking."
(test-system-defaults--with-load-environment
- (let ((vc-follow-symlinks nil))
- (load (expand-file-name "modules/system-defaults.el"
- test-system-defaults--repo-root)
- nil t)
- (should (eq vc-follow-symlinks t)))))
+ (let ((vc-follow-symlinks nil))
+ (test-system-defaults--load)
+ (should (eq vc-follow-symlinks t)))))
(provide 'test-system-defaults-vc-follow-symlinks)
;;; test-system-defaults-vc-follow-symlinks.el ends here