aboutsummaryrefslogtreecommitdiff
path: root/compat-tests.el
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-12-15 00:48:26 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-12-15 01:19:47 +0100
commit5be942f10fab7fed8321a9e20fe831730d79738b (patch)
tree7e379f96dba6f99e5821929b25aeae630f9e8966 /compat-tests.el
parentf06c24c2498a8b9642fdef3bd8336ac75da4ad07 (diff)
compat-30: untrusted-content, trusted-files, trusted-content-p
Diffstat (limited to 'compat-tests.el')
-rw-r--r--compat-tests.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/compat-tests.el b/compat-tests.el
index b736015..b8ae0c1 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -3232,5 +3232,31 @@
(let ((completion-category-overrides '((compat-test (a . 10)))))
(should-equal 10 (compat-call completion-metadata-get md 'a))))))
+(ert-deftest compat-untrusted-content ()
+ (should (local-variable-if-set-p 'untrusted-content)))
+
+(ert-deftest compat-trusted-files ()
+ (static-if (< emacs-major-version 30) ;; TODO reenable on Emacs 30
+ (progn
+ (should (boundp 'trusted-files))
+ (should (risky-local-variable-p 'trusted-files)))))
+
+(ert-deftest compat-trusted-content-p ()
+ (static-if (< emacs-major-version 30) ;; TODO reenable on Emacs 30
+ (progn
+ (should-not (trusted-content-p))
+ (let ((untrusted-content t)
+ (buffer-file-truename user-init-file))
+ (should-not (trusted-content-p)))
+ (let ((buffer-file-truename (expand-file-name "compat-tests.el")))
+ (should-not (trusted-content-p)))
+ (let ((buffer-file-truename (expand-file-name "compat-tests.el"))
+ (trusted-files '("compat-tests.el")))
+ (should (trusted-content-p)))
+ (let ((untrusted-content t)
+ (buffer-file-truename (expand-file-name "compat-tests.el"))
+ (trusted-files '("compat-tests.el")))
+ (should-not (trusted-content-p))))))
+
(provide 'compat-tests)
;;; compat-tests.el ends here