diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-07 14:39:37 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-07 14:39:37 +0100 |
| commit | 2256db9958ebfc3adf0855f07ca9efd8bbf484bd (patch) | |
| tree | 5952fa7438a806430ff251ac6d0e21323c9cb183 | |
| parent | 2290e0b50867371042b48b361d371e71c2dd58e2 (diff) | |
compat-tests: Add test for with-environment-variables
| -rw-r--r-- | compat-26.el | 2 | ||||
| -rw-r--r-- | compat-28.el | 2 | ||||
| -rw-r--r-- | compat-tests.el | 11 |
3 files changed, 13 insertions, 2 deletions
diff --git a/compat-26.el b/compat-26.el index 4578f2a..a1fae8a 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 0f5e464..d4bf811 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 0098b17..487eca8 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")) |
