branch: externals/compat commit 61c2b8815b3a252659fb7e427b1a816b051d05de Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Test with-file-modes --- compat-25.el | 2 +- compat-tests.el | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/compat-25.el b/compat-25.el index afc82b64c8..b58dcf6145 100644 --- a/compat-25.el +++ b/compat-25.el @@ -76,7 +76,7 @@ Case is significant. Symbols are also allowed; their print names are used instead." (string-lessp string2 string1)) -(compat-defmacro with-file-modes (modes &rest body) ;; <UNTESTED> +(compat-defmacro with-file-modes (modes &rest body) ;; <OK> "Execute BODY with default file permissions temporarily set to MODES. MODES is as for `set-default-file-modes'." (declare (indent 1) (debug t)) diff --git a/compat-tests.el b/compat-tests.el index 542d4926a3..db2fea3637 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -649,6 +649,12 @@ (should-equal "1 k" (compat-call file-size-human-readable 1000 'si " ")) (should-equal "1 kA" (compat-call file-size-human-readable 1000 'si " " "A"))) +(ert-deftest with-file-modes () + (let ((old (default-file-modes))) + (with-file-modes (1+ old) + (should-equal (default-file-modes) (1+ old))) + (should-equal (default-file-modes) old))) + (ert-deftest file-modes-number-to-symbolic () (should-equal "-rwx------" (file-modes-number-to-symbolic #o700)) (should-equal "-rwxrwx---" (file-modes-number-to-symbolic #o770))