summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-03 19:10:47 -0500
committerCraig Jennings <c@cjennings.net>2026-05-03 19:10:47 -0500
commit875887fc3821869c7ca8f23777e79caa00b3999e (patch)
treef0a7985a235bdb68ba0f06f063465a962d98a55d /tests
parent9acaf3899aedb69300a29a0d0c8b468e5f4ad729 (diff)
downloaddotemacs-875887fc3821869c7ca8f23777e79caa00b3999e.tar.gz
dotemacs-875887fc3821869c7ca8f23777e79caa00b3999e.zip
fix: set vc-follow-symlinks explicitly to t
The line read `(setq-default vc-follow-symlinks)` with no value. That left the variable at nil, so the comment "don't ask to follow symlinks if target is version controlled" was a lie. Opening any version-controlled symlink still prompted. I checked the Emacs docs first. The value `t` is the one that follows the link without asking, so that's what I set. I added `tests/test-system-defaults-vc-follow-symlinks.el` as a regression test. It loads the module with the unrelated side effects stubbed and asserts `vc-follow-symlinks` ends up as `t`.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-system-defaults-vc-follow-symlinks.el66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/test-system-defaults-vc-follow-symlinks.el b/tests/test-system-defaults-vc-follow-symlinks.el
new file mode 100644
index 00000000..34406986
--- /dev/null
+++ b/tests/test-system-defaults-vc-follow-symlinks.el
@@ -0,0 +1,66 @@
+;;; test-system-defaults-vc-follow-symlinks.el --- Tests for VC symlink default -*- lexical-binding: t; -*-
+
+;;; Commentary:
+
+;; system-defaults.el has startup side effects, so load it with unrelated
+;; external interactions stubbed and assert the setting this file owns.
+
+;;; 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)))
+
+(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)))))
+
+(provide 'test-system-defaults-vc-follow-symlinks)
+;;; test-system-defaults-vc-follow-symlinks.el ends here