Some more tests for bos/eos.

This commit is contained in:
jaortega 2008-02-15 23:33:45 +00:00
parent 35e91dcfd2
commit a48b4c18a4
1 changed files with 10 additions and 4 deletions

View File

@ -362,16 +362,22 @@
(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)))
(name (format #f "e/bos-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)
(blank-rx (rx bos (* white) #\newline eos))
(start-with-a (rx bos "a"))
(end-with-b (rx "b" eos)))
(add-rx-test (rx eos) "anything" #t)
(add-rx-test (rx bos) "really anything" #t)
(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-rx-test blank-rx "\t \t \n\n" #t)
(add-rx-test start-with-a "a haha \n\t" #t)
(add-rx-test start-with-a "ahora" #t)
(add-rx-test end-with-b "blurb" #t))
(add-test! 'regexp-substitute/global-test-1 'pattern-matching
(lambda ()