diff options
| -rw-r--r-- | compat-28.el | 2 | ||||
| -rw-r--r-- | compat-tests.el | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/compat-28.el b/compat-28.el index 6aef33d..29a7942 100644 --- a/compat-28.el +++ b/compat-28.el @@ -546,7 +546,7 @@ See also `file-name-sans-extension'." (t (concat (file-name-sans-extension filename) "." extn))))) -(compat-defun directory-empty-p (dir) ;; <UNTESTED> +(compat-defun directory-empty-p (dir) ;; <compat-tests:directory-empty-p> "Return t if DIR names an existing directory containing no other files. Return nil if DIR does not name a directory, or if there was trouble determining whether DIR is a directory or empty. diff --git a/compat-tests.el b/compat-tests.el index a12ba12..a83f48f 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -1131,6 +1131,15 @@ (should (directory-name-p "dir/subdir/")) (should-not (directory-name-p "dir/subdir"))) +(ert-deftest directory-empty-p () + (let ((name (make-temp-name "compat-tests"))) + (make-directory name) + (should (directory-empty-p name)) + (make-empty-file (file-name-concat name "file")) + (should-not (directory-empty-p name)) + (delete-file (file-name-concat name "file")) + (delete-directory name))) + (ert-deftest make-empty-file () (let ((name (make-temp-name "compat-tests"))) (should-not (file-exists-p name)) |
