branch: externals/compat commit 47953b014f3023c9ff791afd73ba040f3043200b Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Add test for file-backup-file-names --- compat-28.el | 2 +- compat-tests.el | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/compat-28.el b/compat-28.el index c58c1d5bc7..64cfcd7913 100644 --- a/compat-28.el +++ b/compat-28.el @@ -594,7 +594,7 @@ the leading `-' char." (if (zerop (logand 1 mode)) ?- ?x) (if (zerop (logand 1 mode)) ?T ?t)))) -(compat-defun file-backup-file-names (filename) ;; <UNTESTED> +(compat-defun file-backup-file-names (filename) ;; <compat-tests:file-backup-file-names> "Return a list of backup files for FILENAME. The list will be sorted by modification time so that the most recent files are first." diff --git a/compat-tests.el b/compat-tests.el index d8aab1c049..dee44693ae 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -1232,6 +1232,17 @@ (should-equal t (always 1)) ;; single argument (should-equal t (always 1 2 3 4))) ;; multiple arguments +(ert-deftest file-backup-file-names () + (let ((file (make-temp-file "compat-tests")) backups) + (should-not (file-backup-file-names file)) + (push (concat file "~") backups) + (make-empty-file (car backups)) + (should-equal backups (file-backup-file-names file)) + (sleep-for 1) ;; FIXME Slowing down the test suite here is not great. + (push (concat file ".~1~") backups) + (make-empty-file (car backups)) + (should-equal backups (file-backup-file-names file)))) + (ert-deftest make-nearby-temp-file () ;; TODO Test tramp remote directory. (let ((file1 (make-nearby-temp-file "compat-tests"))