diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2021-02-18 11:11:11 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2021-02-18 11:32:50 +0100 |
commit | 892db042a0d85caeea9a4969073e13f525eb9f60 (patch) | |
tree | 9f788aa6079518167673d2510b8ae5306fe5c872 /test/lisp/emacs-lisp/rx-tests.el | |
parent | 8358637936c455d906675932db4cbf90c35b6c53 (diff) | |
download | emacs-892db042a0d85caeea9a4969073e13f525eb9f60.tar.gz emacs-892db042a0d85caeea9a4969073e13f525eb9f60.tar.bz2 emacs-892db042a0d85caeea9a4969073e13f525eb9f60.zip |
Fix rx `regexp` form with deprecated syntax
The argument of the rx `regexp` form is assumed to evaluate to a valid
regexp, but certain kinds of deprecated but still accepted usage were
not handled correctly, such as unescaped literal (special) characters:
(rx "a" (regexp "*")) => "a*" which is wrong.
Handle these cases; there is no extra trouble.
* lisp/emacs-lisp/rx.el (rx--translate-regexp): Force bracketing
of single special characters.
* test/lisp/emacs-lisp/rx-tests.el (rx-regexp): Add test case.
Diffstat (limited to 'test/lisp/emacs-lisp/rx-tests.el')
-rw-r--r-- | test/lisp/emacs-lisp/rx-tests.el | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index 63d7c7b91ea..388c5e86b4c 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -391,6 +391,8 @@ (let ((x "a*")) (should (equal (rx (regexp x) "b") "\\(?:a*\\)b")) + (should (equal (rx "a" (regexp "*")) + "a\\(?:*\\)")) (should (equal (rx "" (regexp x) (eval "")) "a*")))) |