summaryrefslogtreecommitdiff
path: root/libregex/test/basic.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-04-13 00:45:52 -0700
committerOri Bernstein <ori@eigenstate.org>2015-04-13 00:45:52 -0700
commit7f7f4995545803a947444b6babf04fb54cce0173 (patch)
tree784a9e1f194744234d0049d048329719f23c1048 /libregex/test/basic.myr
parent769c1e76b0af199cf5a8d3336de9f3f642f1b688 (diff)
downloadmc-7f7f4995545803a947444b6babf04fb54cce0173.tar.gz
Move code to subdir in preparation for merging with mc.
Diffstat (limited to 'libregex/test/basic.myr')
-rw-r--r--libregex/test/basic.myr31
1 files changed, 31 insertions, 0 deletions
diff --git a/libregex/test/basic.myr b/libregex/test/basic.myr
new file mode 100644
index 0000000..92816fa
--- /dev/null
+++ b/libregex/test/basic.myr
@@ -0,0 +1,31 @@
+use std
+
+use "testmatch.use"
+
+const main = {
+ var s : byte[:]
+
+ s = std.strjoin([
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ ][:], "")
+ testmatch(".*bc", "Abc")
+ testmatch("(a*)*", "a")
+ testmatch("(aa|aab?)*", s)
+ /* greedy matches */
+ testmatch("(<.*>).*", "<a foo> blah <bar>")
+ testmatch("(<.+>).*", "<a foo> blah <bar>")
+ /* reluctant matches */
+ testmatch("(<.*?>).*", "<a foo> blah <bar>")
+ testmatch("(<.+?>).*", "<a foo> blah <bar>")
+}