summaryrefslogtreecommitdiff
path: root/libregex/test/boundaries.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/boundaries.myr
parent769c1e76b0af199cf5a8d3336de9f3f642f1b688 (diff)
downloadmc-7f7f4995545803a947444b6babf04fb54cce0173.tar.gz
Move code to subdir in preparation for merging with mc.
Diffstat (limited to 'libregex/test/boundaries.myr')
-rw-r--r--libregex/test/boundaries.myr17
1 files changed, 17 insertions, 0 deletions
diff --git a/libregex/test/boundaries.myr b/libregex/test/boundaries.myr
new file mode 100644
index 0000000..03157e4
--- /dev/null
+++ b/libregex/test/boundaries.myr
@@ -0,0 +1,17 @@
+use "testmatch.use"
+
+const main = {
+ /* expected matches */
+ testmatch("\\<([a-z]*)\\>", "abcdef") /* whole word */
+ testmatch(".*(\\<.*\\>).*", "!m!") /* single char word in midstring */
+ testmatch(".*(\\<.*\\>).*", "!m") /* single char word at end of string */
+ testmatch(".*(\\<.*\\>).*", "m!") /* single char word at start of string */
+ testmatch(".*(\\<.*\\>).*", "!@#!!matches!!%!") /* word in midstring */
+ testmatch(".*(\\<.*\\>).*", "matches!!%!") /* word at start of string */
+ testmatch(".*(\\<.*\\>).*", "!@#!!matches") /* word at end of string */
+ testmatch(".*(\\<.*\\>).*", "!@#!!matches!!%!foo") /* matches last word in string */
+ testmatch(".*(\\<.*\\>).*", "123") /* numbers are also word bounds */
+
+ /* nonmatches */
+ testmatch("\\<([a-z]*)\\>foo", "abcdefoo") /* word boundary needed in midstring */
+}