Unit test that reveals the problem with REGEXP-SEARCH? after merging 0.6 branch.

This commit is contained in:
jaortega 2008-01-26 20:17:21 +00:00
parent ed5febd39e
commit b0d75bda86
1 changed files with 41 additions and 26 deletions

View File

@ -358,6 +358,21 @@
(not (regexp-search? (rx "abc") "abcdefg" 3))
(not (regexp-search? (rx "cba") "abcdefg")))))
(letrec ((count 1)
(add-rx-test
(lambda (regexp str/lst result)
(let ((str (if (string? str/lst) str/lst (list->string str/lst)))
(name (format #f "regexp-search?-test-~d" count)))
(set! count (+ 1 count))
(add-test! (string->symbol name) 'pattern-matching
(lambda () (equal? (regexp-search? regexp str) result))))))
(blank-rx (rx bos (* white) #\newline eos)))
(add-rx-test blank-rx "abcd\na" #f)
(add-rx-test blank-rx '(#\newline) #t)
(add-rx-test blank-rx '(#\newline #\newline) #t)
(add-rx-test blank-rx '(#\space #\space #\newline) #t)
(add-rx-test blank-rx "\t \t \n\n" #t))
(add-test! 'regexp-substitute/global-test-1 'pattern-matching
(lambda ()
(equal? "dry Jin"