summaryrefslogtreecommitdiff
path: root/test/lisp/eshell/em-glob-tests.el
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2024-04-01 18:50:20 +0800
committerSean Whitton <spwhitton@spwhitton.name>2024-04-01 18:50:20 +0800
commit0fef2018445b257bf26814e6659bc2ff5b270d77 (patch)
tree2310ce1fd8781a6203ec56e2f985f6adfcc2278d /test/lisp/eshell/em-glob-tests.el
parent3a8546615a38337dc991f6546ade63a372edc2ca (diff)
parent49f76dcc17055e60569b6096e8ea3c9961ebbf63 (diff)
downloademacs-0fef2018445b257bf26814e6659bc2ff5b270d77.tar.gz
Merge branch 'athena/unstable' into athena/bookworm-backports
Diffstat (limited to 'test/lisp/eshell/em-glob-tests.el')
-rw-r--r--test/lisp/eshell/em-glob-tests.el30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/lisp/eshell/em-glob-tests.el b/test/lisp/eshell/em-glob-tests.el
index 6d922666ea3..fc460a59eed 100644
--- a/test/lisp/eshell/em-glob-tests.el
+++ b/test/lisp/eshell/em-glob-tests.el
@@ -61,6 +61,9 @@ component ending in \"symlink\" is treated as a symbolic link."
;;; Tests:
+
+;; Glob expansion
+
(ert-deftest em-glob-test/expand/splice-results ()
"Test that globs are spliced into the argument list when
`eshell-glob-splice-results' is non-nil."
@@ -115,6 +118,33 @@ value of `eshell-glob-splice-results'."
(eshell-command-result-equal "list ${listify *.no}"
'(("*.no"))))))))
+
+;; Glob conversion
+
+(ert-deftest em-glob-test/convert/current-start-directory ()
+ "Test converting a glob starting in the current directory."
+ (should (equal (eshell-glob-convert "*.el")
+ '("./" (("\\`.*\\.el\\'" . "\\`\\.")) nil))))
+
+(ert-deftest em-glob-test/convert/relative-start-directory ()
+ "Test converting a glob starting in a relative directory."
+ (should (equal (eshell-glob-convert "some/where/*.el")
+ '("./some/where/" (("\\`.*\\.el\\'" . "\\`\\.")) nil))))
+
+(ert-deftest em-glob-test/convert/absolute-start-directory ()
+ "Test converting a glob starting in an absolute directory."
+ (should (equal (eshell-glob-convert "/some/where/*.el")
+ '("/some/where/" (("\\`.*\\.el\\'" . "\\`\\.")) nil))))
+
+(ert-deftest em-glob-test/convert/remote-start-directory ()
+ "Test converting a glob starting in a remote directory."
+ (should (equal (eshell-glob-convert "/ssh:nowhere.invalid:some/where/*.el")
+ '("/ssh:nowhere.invalid:/some/where/"
+ (("\\`.*\\.el\\'" . "\\`\\.")) nil))))
+
+
+;; Glob matching
+
(ert-deftest em-glob-test/match-any-string ()
"Test that \"*\" pattern matches any string."
(with-fake-files '("a.el" "b.el" "c.txt" "dir/a.el")