summaryrefslogtreecommitdiffstats
path: root/tests/015/regex.tl
blob: 68058eea8b4740e281b95df4aac09e704da1463b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(load "../common")

(defun rum (str regex : include-match)
  (with-in-string-stream (s str)
    (list (read-until-match regex s include-match)
          (read-until-match regex s include-match))))

(mtest
  (rum "a-b" #/-/) ("a" "b")
  (rum "a-b" #/-/ t) ("a-" "b")
  (rum "a----b" #/-+/) ("a" "b")
  (rum "a----b" #/-+/ t) ("a----" "b")
  (rum "a----b" #/-*/) ("a" "b")
  (rum "a----b" #/-*/ t) ("a----" "b")
  (rum "abc" #/-/) ("abc" nil)
  (rum "abc" #/-/ t) ("abc" nil)
  (rum "a___b___#c" #/_+#/) ("a___b" "c")
  (rum "a___b___#c" #/_+#/ t) ("a___b___#" "c"))