summaryrefslogtreecommitdiffstats
path: root/tests/015/regex.tl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/015/regex.tl')
-rw-r--r--tests/015/regex.tl18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/015/regex.tl b/tests/015/regex.tl
new file mode 100644
index 00000000..68058eea
--- /dev/null
+++ b/tests/015/regex.tl
@@ -0,0 +1,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"))