diff options
| author | Jim Porter | 2022-06-24 08:39:42 -0700 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-06-26 16:52:36 +0200 |
| commit | ea3681575f24ab6766931d0c86f080c52f2ce2d7 (patch) | |
| tree | b34466ad22ff94bd3a26aa0d9e98e43b78393d67 /test/lisp/eshell | |
| parent | 598d7c5d1c10bfb161cb53aa76d480864414487c (diff) | |
| download | emacs-ea3681575f24ab6766931d0c86f080c52f2ce2d7.tar.gz emacs-ea3681575f24ab6766931d0c86f080c52f2ce2d7.zip | |
Convert Eshell globs ahead of time instead of doing it repeatedly
* lisp/eshell/em-glob.el (eshell-glob-recursive): New variable.
(eshell-glob-convert-1, eshell-glob-convert): New functions.
(eshell-extended-glob): Use 'eshell-glob-convert'.
(eshell-glob-entries): Adapt function to use pre-converted globs.
* test/lisp/eshell-em-glob-tests.el (em-glob-test/match-dot-files):
New test.
Diffstat (limited to 'test/lisp/eshell')
| -rw-r--r-- | test/lisp/eshell/em-glob-tests.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lisp/eshell/em-glob-tests.el b/test/lisp/eshell/em-glob-tests.el index 9976b32ffe7..65f340a8dad 100644 --- a/test/lisp/eshell/em-glob-tests.el +++ b/test/lisp/eshell/em-glob-tests.el | |||
| @@ -160,6 +160,21 @@ component ending in \"symlink\" is treated as a symbolic link." | |||
| 160 | (should (equal (eshell-extended-glob "[[:digit:]]##~4?") | 160 | (should (equal (eshell-extended-glob "[[:digit:]]##~4?") |
| 161 | '("1" "12" "123"))))) | 161 | '("1" "12" "123"))))) |
| 162 | 162 | ||
| 163 | (ert-deftest em-glob-test/match-dot-files () | ||
| 164 | "Test that dot files are matched correctly." | ||
| 165 | (with-fake-files '("foo.el" ".emacs") | ||
| 166 | (should (equal (eshell-extended-glob ".*") | ||
| 167 | '("../" "./" ".emacs"))) | ||
| 168 | (let (eshell-glob-include-dot-dot) | ||
| 169 | (should (equal (eshell-extended-glob ".*") | ||
| 170 | '(".emacs")))) | ||
| 171 | (let ((eshell-glob-include-dot-files t)) | ||
| 172 | (should (equal (eshell-extended-glob "*") | ||
| 173 | '("../" "./" ".emacs" "foo.el"))) | ||
| 174 | (let (eshell-glob-include-dot-dot) | ||
| 175 | (should (equal (eshell-extended-glob "*") | ||
| 176 | '(".emacs" "foo.el"))))))) | ||
| 177 | |||
| 163 | (ert-deftest em-glob-test/no-matches () | 178 | (ert-deftest em-glob-test/no-matches () |
| 164 | "Test behavior when a glob fails to match any files." | 179 | "Test behavior when a glob fails to match any files." |
| 165 | (with-fake-files '("foo.el" "bar.el") | 180 | (with-fake-files '("foo.el" "bar.el") |