aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-23 03:21:07 -0500
committerCraig Jennings <c@cjennings.net>2026-05-23 03:21:07 -0500
commitb63c4f83081ec50074307cdbaff68525869d7294 (patch)
tree0dd5db4405401efe2aaf870ae49eecd8ae5de4cb /tests
parent61adf68a0e14ad76c276fd6f39162f25f78302b1 (diff)
downloaddotemacs-b63c4f83081ec50074307cdbaff68525869d7294.tar.gz
dotemacs-b63c4f83081ec50074307cdbaff68525869d7294.zip
fix(dirvish): declare runtime constant/util deps with plain require
dirvish-config builds `dirvish-quick-access-entries` from `code-dir`, `music-dir`, `pix-dir`, and the recording dirs at load time, and binds keys to `cj/xdg-open` and `cj/open-file-with-command`. Those come from user-constants and system-utils, but the module only required them under `eval-when-compile`, so the compiled module carries no runtime require and leans on init order having loaded them first. I switched both to plain requires, matching host-environment, system-lib, and external-open-lib right below. Added a dependency-contract smoke test that fails if the requires are dropped.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-dirvish-config-runtime-requires.el30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test-dirvish-config-runtime-requires.el b/tests/test-dirvish-config-runtime-requires.el
new file mode 100644
index 00000000..34fb67ac
--- /dev/null
+++ b/tests/test-dirvish-config-runtime-requires.el
@@ -0,0 +1,30 @@
+;;; test-dirvish-config-runtime-requires.el --- dirvish-config declares its deps -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; dirvish-config.el builds `dirvish-quick-access-entries' from `code-dir',
+;; `music-dir', `pix-dir' (and friends) at load time and binds keys to
+;; `cj/xdg-open' / `cj/open-file-with-command', so it depends on user-constants
+;; and system-utils at runtime. Those were declared with `eval-when-compile',
+;; which leaves the compiled module without the requires at load — fragile
+;; under init order. This is a dependency-contract smoke test: requiring
+;; dirvish-config in isolation must pull both features in, so it fails if the
+;; requires are dropped entirely. (It can't catch a downgrade back to
+;; `eval-when-compile', since that form still runs when the file loads as
+;; source, which the test harness does — that regression is guarded by keeping
+;; the plain requires in review, not by this test.)
+
+;;; Code:
+
+(require 'ert)
+(require 'dirvish-config)
+
+(ert-deftest test-dirvish-config-loads-user-constants ()
+ "Normal: requiring dirvish-config pulls in user-constants at runtime."
+ (should (featurep 'user-constants)))
+
+(ert-deftest test-dirvish-config-loads-system-utils ()
+ "Normal: requiring dirvish-config pulls in system-utils at runtime."
+ (should (featurep 'system-utils)))
+
+(provide 'test-dirvish-config-runtime-requires)
+;;; test-dirvish-config-runtime-requires.el ends here