picrin/contrib/30.regexp/t/test.scm

13 lines
533 B
Scheme
Raw Normal View History

2014-07-22 08:34:23 -04:00
(import (scheme base)
(picrin test)
(picrin regexp))
(test #t (regexp? (regexp "simple")))
(test #f (regexp? "it\\s[s]e+ms\\s(reg)?exp"))
(test-values (values '("abcd" "b") '(5 6)) (regexp-match (regexp "a(b)cd") "abdacabcd"))
(test '("a" "b" "c" "d") (regexp-split (regexp ",") "a,b,c,d"))
(test '("a" "b" "c" "d") (regexp-split (regexp "\\.+") "a.b....c.....d"))
2014-07-22 08:49:06 -04:00
(test "a b c d" (regexp-replace (regexp ",") "a,b,c,d" " "))
2015-05-11 03:05:40 -04:00
(test "newline tab space " (regexp-replace (regexp "[\n\t ]") "newline
2014-07-22 08:49:06 -04:00
tab space " " "))