summaryrefslogtreecommitdiff
path: root/libregex/test/basic.myr
diff options
context:
space:
mode:
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>")
+}