summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/dirvish-config.el4
-rw-r--r--tests/test-dirvish-config-runtime-requires.el30
2 files changed, 32 insertions, 2 deletions
diff --git a/modules/dirvish-config.el b/modules/dirvish-config.el
index 5f5ca7fc..774c9ab7 100644
--- a/modules/dirvish-config.el
+++ b/modules/dirvish-config.el
@@ -24,8 +24,8 @@
;;; Code:
-(eval-when-compile (require 'user-constants))
-(eval-when-compile (require 'system-utils))
+(require 'user-constants) ;; code-dir, music-dir, pix-dir et al. used at load time
+(require 'system-utils) ;; cj/xdg-open, cj/open-file-with-command bound to keys
(require 'host-environment)
(require 'system-lib)
(require 'external-open-lib)
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