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

13 lines
529 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"))
(test "a b c d" (regexp-replace (regexp ",") " " "a,b,c,d"))
(test "newline tab spase " (regexp-replace (regexp "\\s") " " "newline
tab space "))