aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorStefan Monnier2023-09-26 11:43:51 -0400
committerStefan Monnier2023-09-26 11:43:51 -0400
commite88be844bf774b336ab67995e435416328b53776 (patch)
treed937036da59671bcde1c1bff176c31605db47b74 /test/src
parent215bfb24dd0de9ba2c82aea330cbb27985ad6eae (diff)
downloademacs-e88be844bf774b336ab67995e435416328b53776.tar.gz
emacs-e88be844bf774b336ab67995e435416328b53776.zip
regex.c (mutually_exclusive_p): Fix initial value of `loop_beg`
* src/regex-emacs.c (mutually_exclusive_p): Don't pretend that pattern position 0 has been checked already. * test/src/regex-emacs-tests.el (regexp-tests-backtrack-optimization): Add a corresponding regression test plus some other related tests I had around.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/regex-emacs-tests.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el
index f2bee713864..c84998e1184 100644
--- a/test/src/regex-emacs-tests.el
+++ b/test/src/regex-emacs-tests.el
@@ -878,10 +878,28 @@ This evaluates the TESTS test cases from glibc."
878 (erase-buffer) 878 (erase-buffer)
879 (insert (make-string 1000000 ?x) "=") 879 (insert (make-string 1000000 ?x) "=")
880 (goto-char (point-min)) 880 (goto-char (point-min))
881 ;; Make sure we do perform the optimization (if we don't, the
882 ;; below will burp with regexp-stack-overflow).
881 (should (looking-at "x*=*")) 883 (should (looking-at "x*=*"))
882 (should (looking-at "x*\\(=\\|:\\)")) 884 (should (looking-at "x*\\(=\\|:\\)"))
883 (should (looking-at "x*\\(=\\|:\\)*")) 885 (should (looking-at "x*\\(=\\|:\\)*"))
884 (should (looking-at "x*=*?")))) 886 (should (looking-at "x*=*?"))
887 (should (looking-at "x*\\(=*\\|h\\)*?"))
888 (should (looking-at "x*\\(=*\\|h\\)*"))
889 (should (looking-at "x*\\(=*?\\|h\\)*"))
890 (should (looking-at "x*\\(=*?\\|h\\)*?"))
891 (should (looking-at "x*\\(=*\\|h\\)+?"))
892 (should (looking-at "x*\\(=*\\|h\\)+"))
893 (should (looking-at "x*\\(=*?\\|h\\)+"))
894 (should (looking-at "x*\\(=*?\\|h\\)+?"))
895 (should (looking-at "x*\\(=+\\|h\\)+?"))
896 (should (looking-at "x*\\(=+\\|h\\)+"))
897 (should (looking-at "x*\\(=+?\\|h\\)+"))
898 (should (looking-at "x*\\(=+?\\|h\\)+?"))
899 ;; Regression check for overly optimistic optimization.
900 (should (eq 0 (string-match "\\(ca*\\|ab\\)+d" "cabd")))
901 (should (string-match "\\(aa*\\|b\\)*c" "ababc"))
902 ))
885 903
886(ert-deftest regexp-tests-zero-width-assertion-repetition () 904(ert-deftest regexp-tests-zero-width-assertion-repetition ()
887 ;; Check compatibility behaviour with repetition operators after 905 ;; Check compatibility behaviour with repetition operators after