diff options
author | Jim Porter <jporterbugs@gmail.com> | 2022-04-26 21:51:23 -0700 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-05-01 20:41:21 +0200 |
commit | bb40507fed7b211bb0ef5b5e3dcc609876f6ad8d (patch) | |
tree | 1ea82c099719bf3caf267ea257027bb90bb22905 /test/lisp/eshell/em-pred-tests.el | |
parent | ade1424a975aabaa208010c6fdd3c8b7c51242ff (diff) | |
download | emacs-bb40507fed7b211bb0ef5b5e3dcc609876f6ad8d.tar.gz emacs-bb40507fed7b211bb0ef5b5e3dcc609876f6ad8d.tar.bz2 emacs-bb40507fed7b211bb0ef5b5e3dcc609876f6ad8d.zip |
Handle escaped characters in Eshell argument predicates/modifiers
* lisp/eshell/em-pred.el (eshell-get-delimited-modifier-argument):
Unescape escaped characters.
* test/lisp/eshell/em-pred-tests.el (em-pred-test/predicate-escaping):
New test (bug#55204).
Diffstat (limited to 'test/lisp/eshell/em-pred-tests.el')
-rw-r--r-- | test/lisp/eshell/em-pred-tests.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/eshell/em-pred-tests.el b/test/lisp/eshell/em-pred-tests.el index 4d2af392923..3b50543d69a 100644 --- a/test/lisp/eshell/em-pred-tests.el +++ b/test/lisp/eshell/em-pred-tests.el @@ -533,4 +533,16 @@ PREDICATE is the predicate used to query that attribute." (format ":j%c-%c" (car delims) (cdr delims))) "foo-bar-baz")))) +(ert-deftest em-pred-test/predicate-escaping () + "Test string escaping in predicate and modifier parameters." + ;; Escaping the delimiter should remove the backslash. + (should (equal (eshell-eval-predicate '("foo" "bar" "baz") ":j'\\''") + "foo'bar'baz")) + ;; Escaping a backlash should remove the first backslash. + (should (equal (eshell-eval-predicate '("foo" "bar" "baz") ":j'\\\\'") + "foo\\bar\\baz")) + ;; Escaping a different character should keep the backslash. + (should (equal (eshell-eval-predicate '("foo" "bar" "baz") ":j'\\\"'") + "foo\\\"bar\\\"baz"))) + ;; em-pred-tests.el ends here |