branch: externals/compat commit 2256db9958ebfc3adf0855f07ca9efd8bbf484bd Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
compat-tests: Add test for with-environment-variables --- compat-26.el | 2 +- compat-28.el | 2 +- compat-tests.el | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/compat-26.el b/compat-26.el index 4578f2a583..a1fae8aa0b 100644 --- a/compat-26.el +++ b/compat-26.el @@ -315,7 +315,7 @@ are non-nil, then the result is non-nil." ;;;; Defined in files.el -(compat-defvar mounted-file-systems ;; <UNTESTED> +(compat-defvar mounted-file-systems ;; <OK> (eval-when-compile (if (memq system-type '(windows-nt cygwin)) "^//[^/]+/" diff --git a/compat-28.el b/compat-28.el index 0f5e4649d6..d4bf81142a 100644 --- a/compat-28.el +++ b/compat-28.el @@ -746,7 +746,7 @@ Other uses risk returning non-nil value that point to the wrong file." ;;;; Defined in env.el -(compat-defmacro with-environment-variables (variables &rest body) ;; <UNTESTED> +(compat-defmacro with-environment-variables (variables &rest body) ;; <OK> "Set VARIABLES in the environent and execute BODY. VARIABLES is a list of variable settings of the form (VAR VALUE), where VAR is the name of the variable (a string) and VALUE diff --git a/compat-tests.el b/compat-tests.el index 0098b17e58..487eca8b57 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -59,6 +59,13 @@ (setq list (funcall sym list "first" 1 #'string=)) (should (eq (compat-call plist-get list "first" #'string=) 1)))) +(ert-deftest with-environment-variables () + (let ((A "COMPAT_TESTS__VAR") (B "/foo/bar")) + (should-not (getenv A)) + (with-environment-variables ((A B)) + (should (equal (getenv A) B))) + (should-not (getenv A)))) + (ert-deftest get-display-property () (with-temp-buffer (insert (propertize "foo" 'face 'bold 'display '(height 2.0))) @@ -669,6 +676,10 @@ (should (directory-name-p "dir/subdir/")) (should-not (directory-name-p "dir/subdir"))) +(ert-deftest mounted-file-systems () + (should-not (string-match-p mounted-file-systems "/etc/")) + (should (string-match-p mounted-file-systems "/mnt/"))) + (ert-deftest make-lock-file-name () (should-equal (expand-file-name ".#") (make-lock-file-name "")) (should-equal (expand-file-name ".#a") (make-lock-file-name "a"))