diff options
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 |