diff options
| author | Stefan Kangas | 2025-03-08 13:02:58 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2025-03-09 18:24:21 +0100 |
| commit | 87db670d045bea2d90139b1f741eea8db7c193ea (patch) | |
| tree | 4523b6f3a49164c6211f1c06192f1e6696b141b4 /test/lisp/files-tests.el | |
| parent | 9c6e8589ee5eae0f793994c96d434b77f54749de (diff) | |
| download | emacs-87db670d045bea2d90139b1f741eea8db7c193ea.tar.gz emacs-87db670d045bea2d90139b1f741eea8db7c193ea.zip | |
Make locate-user-emacs-file accept a list too
This can be used to migrate to a new name, while also keeping
backwards-compatible support for an old name.
* lisp/files.el (locate-user-emacs-file): Accept a list as the
NEW-NAME argument.
* test/lisp/files-tests.el (files-test-locate-user-emacs-file): New
test for the above.
Diffstat (limited to 'test/lisp/files-tests.el')
| -rw-r--r-- | test/lisp/files-tests.el | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index ed63b6f6fb4..9f17747da1f 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el | |||
| @@ -68,7 +68,18 @@ | |||
| 68 | (should (equal (locate-user-emacs-file basename) | 68 | (should (equal (locate-user-emacs-file basename) |
| 69 | in-edir)) | 69 | in-edir)) |
| 70 | (should (equal (locate-user-emacs-file basename "anything") | 70 | (should (equal (locate-user-emacs-file basename "anything") |
| 71 | in-edir))))))) | 71 | in-edir))) |
| 72 | ;; NEW-FILE is a list. | ||
| 73 | (should (equal (locate-user-emacs-file '("first" "second")) | ||
| 74 | (expand-file-name "first" user-emacs-directory))) | ||
| 75 | (should (equal (locate-user-emacs-file '("first" "second") "never") | ||
| 76 | (expand-file-name "first" user-emacs-directory))) | ||
| 77 | (let ((exists (expand-file-name "exists" user-emacs-directory))) | ||
| 78 | (write-region "data" nil exists nil 'quietly) | ||
| 79 | (should (equal (locate-user-emacs-file '("missing" "exists")) | ||
| 80 | exists)) | ||
| 81 | (should (equal (locate-user-emacs-file '("missing1" "exists") "missing2") | ||
| 82 | exists))))))) | ||
| 72 | 83 | ||
| 73 | ;; Test combinations: | 84 | ;; Test combinations: |
| 74 | ;; `enable-local-variables' t, nil, :safe, :all, or something else. | 85 | ;; `enable-local-variables' t, nil, :safe, :all, or something else. |