aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/eshell
diff options
context:
space:
mode:
authorJim Porter2022-04-26 21:51:23 -0700
committerLars Ingebrigtsen2022-05-01 20:41:21 +0200
commitbb40507fed7b211bb0ef5b5e3dcc609876f6ad8d (patch)
tree1ea82c099719bf3caf267ea257027bb90bb22905 /test/lisp/eshell
parentade1424a975aabaa208010c6fdd3c8b7c51242ff (diff)
downloademacs-bb40507fed7b211bb0ef5b5e3dcc609876f6ad8d.tar.gz
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')
-rw-r--r--test/lisp/eshell/em-pred-tests.el12
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."
533 (format ":j%c-%c" (car delims) (cdr delims))) 533 (format ":j%c-%c" (car delims) (cdr delims)))
534 "foo-bar-baz")))) 534 "foo-bar-baz"))))
535 535
536(ert-deftest em-pred-test/predicate-escaping ()
537 "Test string escaping in predicate and modifier parameters."
538 ;; Escaping the delimiter should remove the backslash.
539 (should (equal (eshell-eval-predicate '("foo" "bar" "baz") ":j'\\''")
540 "foo'bar'baz"))
541 ;; Escaping a backlash should remove the first backslash.
542 (should (equal (eshell-eval-predicate '("foo" "bar" "baz") ":j'\\\\'")
543 "foo\\bar\\baz"))
544 ;; Escaping a different character should keep the backslash.
545 (should (equal (eshell-eval-predicate '("foo" "bar" "baz") ":j'\\\"'")
546 "foo\\\"bar\\\"baz")))
547
536;; em-pred-tests.el ends here 548;; em-pred-tests.el ends here