summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/rx-tests.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2020-02-11 13:23:10 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2020-02-12 11:20:47 +0100
commit5a21aaff468ec3f0337117707cda4254cbef8de7 (patch)
tree0afe3c99c133c701c549ee20cb2073a90aa0dc25 /test/lisp/emacs-lisp/rx-tests.el
parent2b12c2b6f22187536f54f32b11589bf5f21c1f09 (diff)
downloademacs-5a21aaff468ec3f0337117707cda4254cbef8de7.tar.gz
emacs-5a21aaff468ec3f0337117707cda4254cbef8de7.tar.bz2
emacs-5a21aaff468ec3f0337117707cda4254cbef8de7.zip
rx: Use longest match for all-string 'or' forms (bug#37659)
Revert to the Emacs 26 semantics that always gave the longest match for rx 'or' forms with only string arguments. This guarantee was never well documented, but it is useful and people likely have come to rely on it. For example, prior to this change, (rx (or ">" ">=")) matched ">" even if the text contained ">=". * lisp/emacs-lisp/rx.el (rx--translate-or): Don't tell regexp-opt to preserve the matching order. * doc/lispref/searching.texi (Rx Constructs): Document the longest-match guarantee for all-string 'or' forms. * test/lisp/emacs-lisp/rx-tests.el (rx-or): Update test.
Diffstat (limited to 'test/lisp/emacs-lisp/rx-tests.el')
-rw-r--r--test/lisp/emacs-lisp/rx-tests.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index e19e626527b..a6c172adfe7 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -43,7 +43,7 @@
(should (equal (rx (or "ab" (| "c" nonl) "de"))
"ab\\|c\\|.\\|de"))
(should (equal (rx (or "ab" "abc" "a"))
- "\\(?:ab\\|abc\\|a\\)"))
+ "\\(?:a\\(?:bc?\\)?\\)"))
(should (equal (rx (| nonl "a") (| "b" blank))
"\\(?:.\\|a\\)\\(?:b\\|[[:blank:]]\\)"))
(should (equal (rx (|))