summaryrefslogtreecommitdiff
path: root/lisp/test/regex.lsp
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-07-01 18:17:44 -0300
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-07-01 18:17:44 -0300
commit618a07e8131f49bbda77d2cfe5832218a561a5c8 (patch)
treeec6ea4a3fffdc9fad7dc8bab3cbdc66673cf292d /lisp/test/regex.lsp
parent946b5b745d9d326799a23f7210b799e1b690643d (diff)
Fix a bug in the regex library
The bug causes the regex parser to enter an infinite loop with certain special patterns with alternatives. Test cases also added to ensure the bug will be triggered by the tests if it is somehow reinstantiated. Also testing commit to xedit git repository.
Diffstat (limited to 'lisp/test/regex.lsp')
-rw-r--r--lisp/test/regex.lsp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/test/regex.lsp b/lisp/test/regex.lsp
index fa6b2fe..9e28efa 100644
--- a/lisp/test/regex.lsp
+++ b/lisp/test/regex.lsp
@@ -438,3 +438,14 @@ foo" :notbol t :noteol t)
(setq re (re-comp "(.*a)?"))
(re-test '((0 . 1)) re "aaaa") ; expected, minimal match
(re-test '((0 . 1) (0 . 1)) re "aaaa" :count 2)
+
+
+;; Tue Dec 11 22:22:51 BRST 2007 Fix a regression with the pattern below
+;; returning a match to an empty string.
+;; Note that inverting the order of the "alternatives" works with the
+;; versions of libre prior to this (one line) fix
+(setq re (re-comp "\\\\\\d{3}|\\\\."))
+(re-test :nomatch re "\\")
+;; previous version should work with the pattern inverted
+(setq re (re-comp "\\\\.|\\\\\\d{3}"))
+(re-test :nomatch re "\\")