aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2023-01-06 19:49:24 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2023-01-06 20:03:12 +0100
commit02f4d3a795fdfc9cf4da6086137e3bfa39747cba (patch)
treee1f2e3dbf60a6f383f2ef356bedbd14a8baeff32
parentdca7636e62f66241f5d026859e31a2d7c4590948 (diff)
compat-tests: Test that no unnecessary compat-* files are loaded
-rw-r--r--compat-tests.el7
-rw-r--r--compat.el3
2 files changed, 9 insertions, 1 deletions
diff --git a/compat-tests.el b/compat-tests.el
index 5c76084..79dcc85 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -45,6 +45,13 @@
(defmacro should-equal (a b)
`(should (equal ,a ,b)))
+(ert-deftest compat-loaded-features ()
+ (let ((version 0))
+ (while (< version 30)
+ (should-equal (> version emacs-major-version)
+ (featurep (intern (format "compat-%s" version))))
+ (setq version (1+ version)))))
+
(ert-deftest compat-function ()
(let ((sym (compat-function plist-put)) list)
(should sym)
diff --git a/compat.el b/compat.el
index 7e37e14..269b947 100644
--- a/compat.el
+++ b/compat.el
@@ -42,7 +42,8 @@
;;; Code:
-(when (< emacs-major-version 29) (require 'compat-29))
+(when (eval-when-compile (< emacs-major-version 29))
+ (require 'compat-29))
(defmacro compat-function (fun)
"Return compatibility function symbol for FUN.