ref: de3086badb9fadb7f1036f8bdad3aa5021453d21
parent: 1b08f4376253dca73868af564b44a7680a02667c
author: Ori Bernstein <[email protected]>
date: Mon Sep 8 09:01:36 EDT 2014
Remove extraneous 'regex-' from test names. They're all bloody regex tests.
--- /dev/null
+++ b/test/basic.myr
@@ -1,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>")
+}
--- /dev/null
+++ b/test/boundaries.myr
@@ -1,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 */
+}
--- /dev/null
+++ b/test/capture.myr
@@ -1,0 +1,9 @@
+use "testmatch.use"
+
+const main = {
+ testmatch("A(.*)", "Abc")
+ testmatch("A(.*)e", "Abcde")
+ testmatch("(a|b)+", "abab")
+ testmatch("A(b(.*)d)e", "Abcde")
+ testmatch("(a?)(a*)(a?)", "aaaa")
+}
--- /dev/null
+++ b/test/class.myr
@@ -1,0 +1,67 @@
+use std
+
+use "testmatch.use"
+
+const main = {
+ asciiclass()
+ set()
+ /*
+ unicodeclass()
+ negasciiclass()
+ negasciirange()
+ negset()
+ */
+}
+
+const asciiclass = {
+ /* \d success */
+ testmatch("\\d", "1")
+ testmatch("\\d\\d", "13")
+ testmatch("\\d+", "13688")
+ /* \d fail */
+ testmatch("\\d", "x")
+ testmatch("\\d\\d", "x3")
+ testmatch("\\d+", "1368f")
+
+ /* \x success */
+ testmatch("\\x", "a")
+ testmatch("\\x\\x", "1F")
+ testmatch("\\x+", "13b8cDEf")
+ /* \x fail */
+ testmatch("\\x", "Z")
+ testmatch("\\x\\x", "fg")
+ testmatch("\\x+", "13b8cg")
+
+ /* \s success */
+ testmatch("\\s", " ")
+ testmatch("\\s\\s", "\t\n")
+ testmatch("\\s+", "\t\n\r \t")
+ /* \s fail */
+ testmatch("\\s", "a")
+ testmatch("\\s\\s", "i\n")
+ testmatch("\\s+", "\t\n\r.\t")
+
+ /* word success */
+ testmatch("\\w+", "abcABC0123_")
+ /* word fail */
+ testmatch("\\w+", "abcABC0123_.")
+
+ /* \h success */
+ testmatch("\\h", " ")
+ testmatch("\\h\\h", "\t ")
+ testmatch("\\h+", "\t \t ")
+ /* \h fail */
+ testmatch("\\h", "\n")
+ testmatch("\\h\\h", "\t\r")
+ testmatch("\\h+", "\t \t.")
+}
+
+const set = {
+ /* ranges */
+ testmatch("[a-z]*", "abcd")
+ testmatch("[a-zA-Z]*", "abCD")
+ testmatch("[a-zA-Z0-9_]*", "_abCD018")
+
+ testmatch("[abc]*", "abba")
+ testmatch("[a-zABC]*", "abBa")
+}
--- /dev/null
+++ b/test/data/basic-expected
@@ -1,0 +1,20 @@
+Matched Abc via .*bc : 1
+ match 0: Abc
+Matched a via (a*)* : 2
+ match 0: a
+ match 1: a
+Matched aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa via (aa|aab?)* : 2
+ match 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ match 1: aa
+Matched <a foo> blah <bar> via (<.*>).* : 2
+ match 0: <a foo> blah <bar>
+ match 1: <a foo> blah <bar>
+Matched <a foo> blah <bar> via (<.+>).* : 2
+ match 0: <a foo> blah <bar>
+ match 1: <a foo> blah <bar>
+Matched <a foo> blah <bar> via (<.*?>).* : 2
+ match 0: <a foo> blah <bar>
+ match 1: <a foo>
+Matched <a foo> blah <bar> via (<.+?>).* : 2
+ match 0: <a foo> blah <bar>
+ match 1: <a foo>
--- /dev/null
+++ b/test/data/boundaries-expected
@@ -1,0 +1,28 @@
+Matched abcdef via \<([a-z]*)\> : 2
+ match 0: abcdef
+ match 1: abcdef
+Matched !m! via .*(\<.*\>).* : 2
+ match 0: !m!
+ match 1: m
+Matched !m via .*(\<.*\>).* : 2
+ match 0: !m
+ match 1: m
+Matched m! via .*(\<.*\>).* : 2
+ match 0: m!
+ match 1: m
+Matched !@#!!matches!!%! via .*(\<.*\>).* : 2
+ match 0: !@#!!matches!!%!
+ match 1: matches
+Matched matches!!%! via .*(\<.*\>).* : 2
+ match 0: matches!!%!
+ match 1: matches
+Matched !@#!!matches via .*(\<.*\>).* : 2
+ match 0: !@#!!matches
+ match 1: matches
+Matched !@#!!matches!!%!foo via .*(\<.*\>).* : 2
+ match 0: !@#!!matches!!%!foo
+ match 1: foo
+Matched 123 via .*(\<.*\>).* : 2
+ match 0: 123
+ match 1: 123
+No match of abcdefoo via \<([a-z]*)\>foo
--- /dev/null
+++ b/test/data/capture-expected
@@ -1,0 +1,18 @@
+Matched Abc via A(.*) : 2
+ match 0: Abc
+ match 1: bc
+Matched Abcde via A(.*)e : 2
+ match 0: Abcde
+ match 1: bcd
+Matched abab via (a|b)+ : 2
+ match 0: abab
+ match 1: b
+Matched Abcde via A(b(.*)d)e : 3
+ match 0: Abcde
+ match 1: c
+ match 2: bcd
+Matched aaaa via (a?)(a*)(a?) : 4
+ match 0: aaaa
+ match 1: a
+ match 2: aaa
+ match 3:
--- /dev/null
+++ b/test/data/class-expected
@@ -1,0 +1,56 @@
+Matched 1 via \d : 1
+ match 0: 1
+Matched 13 via \d\d : 1
+ match 0: 13
+Matched 13688 via \d+ : 1
+ match 0: 13688
+No match of x via \d
+No match of x3 via \d\d
+No match of 1368f via \d+
+Matched a via \x : 1
+ match 0: a
+Matched 1F via \x\x : 1
+ match 0: 1F
+Matched 13b8cDEf via \x+ : 1
+ match 0: 13b8cDEf
+No match of Z via \x
+No match of fg via \x\x
+No match of 13b8cg via \x+
+Matched via \s : 1
+ match 0:
+Matched
+ via \s\s : 1
+ match 0:
+
+Matched
+ via \s+ : 1
+ match 0:
+
+No match of a via \s
+No match of i
+ via \s\s
+No match of
+ . via \s+
+Matched abcABC0123_ via \w+ : 1
+ match 0: abcABC0123_
+No match of abcABC0123_. via \w+
+Matched via \h : 1
+ match 0:
+Matched via \h\h : 1
+ match 0:
+Matched via \h+ : 1
+ match 0:
+No match of
+ via \h
+No match of via \h\h
+No match of . via \h+
+Matched abcd via [a-z]* : 1
+ match 0: abcd
+Matched abCD via [a-zA-Z]* : 1
+ match 0: abCD
+Matched _abCD018 via [a-zA-Z0-9_]* : 1
+ match 0: _abCD018
+Matched abba via [abc]* : 1
+ match 0: abba
+Matched abBa via [a-zABC]* : 1
+ match 0: abBa
--- /dev/null
+++ b/test/data/failmatch-expected
@@ -1,0 +1,1 @@
+No match of Abc via .*bcd
--- /dev/null
+++ b/test/data/negclass-expected
@@ -1,0 +1,54 @@
+Matched x via \D : 1
+ match 0: x
+Matched xa!#^cs via \D+ : 1
+ match 0: xa!#^cs
+No match of 0 via \D
+No match of 9 via \D
+No match of a35x via \D+
+No match of 13688 via \D+
+Matched Z via \X : 1
+ match 0: Z
+Matched gg via \X\X : 1
+ match 0: gg
+No match of a via \X
+No match of zz13b8cDEf via \X+
+Matched a via \S : 1
+ match 0: a
+Matched i% via \S\S : 1
+ match 0: i%
+Matched alskd690!#!! via \S+ : 1
+ match 0: alskd690!#!!
+No match of via \S
+No match of
+ via \S\S
+No match of
+kait via \S+
+Matched !%!^^@@!^ via \W+ : 1
+ match 0: !%!^^@@!^
+No match of a^#$bcABC0123_ via \W+
+Matched
+ via \H : 1
+ match 0:
+
+Matched
+ via \H\H : 1
+ match 0:
+
+No match of . via \H+
+No match of via \H\H
+No match of a35 via \H+
+Matched ABCD via [^a-z]* : 1
+ match 0: ABCD
+Matched 1234 via [^a-zA-Z]* : 1
+ match 0: 1234
+Matched -^^- via [^a-zA-Z0-9_]* : 1
+ match 0: -^^-
+Matched d6d via [^abc]* : 1
+ match 0: d6d
+Matched !^!!))# via [^a-zABC]* : 1
+ match 0: !^!!))#
+No match of abcd via [^a-z]*
+No match of abCD via [^a-zA-Z]*
+No match of _abCD018 via [^a-zA-Z0-9_]*
+No match of abba via [^abc]*
+No match of abBa via [^a-zABC]*
--- a/test/data/regex-basic-expected
+++ /dev/null
@@ -1,20 +1,0 @@
-Matched Abc via .*bc : 1
- match 0: Abc
-Matched a via (a*)* : 2
- match 0: a
- match 1: a
-Matched aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa via (aa|aab?)* : 2
- match 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- match 1: aa
-Matched <a foo> blah <bar> via (<.*>).* : 2
- match 0: <a foo> blah <bar>
- match 1: <a foo> blah <bar>
-Matched <a foo> blah <bar> via (<.+>).* : 2
- match 0: <a foo> blah <bar>
- match 1: <a foo> blah <bar>
-Matched <a foo> blah <bar> via (<.*?>).* : 2
- match 0: <a foo> blah <bar>
- match 1: <a foo>
-Matched <a foo> blah <bar> via (<.+?>).* : 2
- match 0: <a foo> blah <bar>
- match 1: <a foo>
--- a/test/data/regex-boundaries-expected
+++ /dev/null
@@ -1,28 +1,0 @@
-Matched abcdef via \<([a-z]*)\> : 2
- match 0: abcdef
- match 1: abcdef
-Matched !m! via .*(\<.*\>).* : 2
- match 0: !m!
- match 1: m
-Matched !m via .*(\<.*\>).* : 2
- match 0: !m
- match 1: m
-Matched m! via .*(\<.*\>).* : 2
- match 0: m!
- match 1: m
-Matched !@#!!matches!!%! via .*(\<.*\>).* : 2
- match 0: !@#!!matches!!%!
- match 1: matches
-Matched matches!!%! via .*(\<.*\>).* : 2
- match 0: matches!!%!
- match 1: matches
-Matched !@#!!matches via .*(\<.*\>).* : 2
- match 0: !@#!!matches
- match 1: matches
-Matched !@#!!matches!!%!foo via .*(\<.*\>).* : 2
- match 0: !@#!!matches!!%!foo
- match 1: foo
-Matched 123 via .*(\<.*\>).* : 2
- match 0: 123
- match 1: 123
-No match of abcdefoo via \<([a-z]*)\>foo
--- a/test/data/regex-capture-expected
+++ /dev/null
@@ -1,18 +1,0 @@
-Matched Abc via A(.*) : 2
- match 0: Abc
- match 1: bc
-Matched Abcde via A(.*)e : 2
- match 0: Abcde
- match 1: bcd
-Matched abab via (a|b)+ : 2
- match 0: abab
- match 1: b
-Matched Abcde via A(b(.*)d)e : 3
- match 0: Abcde
- match 1: c
- match 2: bcd
-Matched aaaa via (a?)(a*)(a?) : 4
- match 0: aaaa
- match 1: a
- match 2: aaa
- match 3:
--- a/test/data/regex-class-expected
+++ /dev/null
@@ -1,56 +1,0 @@
-Matched 1 via \d : 1
- match 0: 1
-Matched 13 via \d\d : 1
- match 0: 13
-Matched 13688 via \d+ : 1
- match 0: 13688
-No match of x via \d
-No match of x3 via \d\d
-No match of 1368f via \d+
-Matched a via \x : 1
- match 0: a
-Matched 1F via \x\x : 1
- match 0: 1F
-Matched 13b8cDEf via \x+ : 1
- match 0: 13b8cDEf
-No match of Z via \x
-No match of fg via \x\x
-No match of 13b8cg via \x+
-Matched via \s : 1
- match 0:
-Matched
- via \s\s : 1
- match 0:
-
-Matched
- via \s+ : 1
- match 0:
-
-No match of a via \s
-No match of i
- via \s\s
-No match of
- . via \s+
-Matched abcABC0123_ via \w+ : 1
- match 0: abcABC0123_
-No match of abcABC0123_. via \w+
-Matched via \h : 1
- match 0:
-Matched via \h\h : 1
- match 0:
-Matched via \h+ : 1
- match 0:
-No match of
- via \h
-No match of via \h\h
-No match of . via \h+
-Matched abcd via [a-z]* : 1
- match 0: abcd
-Matched abCD via [a-zA-Z]* : 1
- match 0: abCD
-Matched _abCD018 via [a-zA-Z0-9_]* : 1
- match 0: _abCD018
-Matched abba via [abc]* : 1
- match 0: abba
-Matched abBa via [a-zABC]* : 1
- match 0: abBa
--- a/test/data/regex-failmatch-expected
+++ /dev/null
@@ -1,1 +1,0 @@
-No match of Abc via .*bcd
--- a/test/data/regex-negclass-expected
+++ /dev/null
@@ -1,54 +1,0 @@
-Matched x via \D : 1
- match 0: x
-Matched xa!#^cs via \D+ : 1
- match 0: xa!#^cs
-No match of 0 via \D
-No match of 9 via \D
-No match of a35x via \D+
-No match of 13688 via \D+
-Matched Z via \X : 1
- match 0: Z
-Matched gg via \X\X : 1
- match 0: gg
-No match of a via \X
-No match of zz13b8cDEf via \X+
-Matched a via \S : 1
- match 0: a
-Matched i% via \S\S : 1
- match 0: i%
-Matched alskd690!#!! via \S+ : 1
- match 0: alskd690!#!!
-No match of via \S
-No match of
- via \S\S
-No match of
-kait via \S+
-Matched !%!^^@@!^ via \W+ : 1
- match 0: !%!^^@@!^
-No match of a^#$bcABC0123_ via \W+
-Matched
- via \H : 1
- match 0:
-
-Matched
- via \H\H : 1
- match 0:
-
-No match of . via \H+
-No match of via \H\H
-No match of a35 via \H+
-Matched ABCD via [^a-z]* : 1
- match 0: ABCD
-Matched 1234 via [^a-zA-Z]* : 1
- match 0: 1234
-Matched -^^- via [^a-zA-Z0-9_]* : 1
- match 0: -^^-
-Matched d6d via [^abc]* : 1
- match 0: d6d
-Matched !^!!))# via [^a-zABC]* : 1
- match 0: !^!!))#
-No match of abcd via [^a-z]*
-No match of abCD via [^a-zA-Z]*
-No match of _abCD018 via [^a-zA-Z0-9_]*
-No match of abba via [^abc]*
-No match of abBa via [^a-zABC]*
--- a/test/data/regex-unicode-expected
+++ /dev/null
@@ -1,11 +1,0 @@
-Matched Abæc via .*bæc : 1
- match 0: Abæc
-Matched Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! via (\p{L}*)bæc\P{L}* : 2
- match 0: Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- match 1: Aa
-Matched Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! via (\pL*)bæc\PL* : 2
- match 0: Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- match 1: Aa
-Matched Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! via (\p{Letter}*)bæc\P{Uppercase_Letter}* : 2
- match 0: Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- match 1: Aa
--- /dev/null
+++ b/test/data/unicode-expected
@@ -1,0 +1,11 @@
+Matched Abæc via .*bæc : 1
+ match 0: Abæc
+Matched Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! via (\p{L}*)bæc\P{L}* : 2
+ match 0: Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ match 1: Aa
+Matched Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! via (\pL*)bæc\PL* : 2
+ match 0: Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ match 1: Aa
+Matched Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! via (\p{Letter}*)bæc\P{Uppercase_Letter}* : 2
+ match 0: Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ match 1: Aa
--- /dev/null
+++ b/test/failmatch.myr
@@ -1,0 +1,8 @@
+use std
+use regex
+
+use "testmatch.use"
+
+const main = {
+ testmatch(".*bcd", "Abc")
+}
--- /dev/null
+++ b/test/negclass.myr
@@ -1,0 +1,72 @@
+use std
+
+use "testmatch.use"
+
+const main = {
+ asciiclass()
+ set()
+ /*
+ unicodeclass()
+ negasciiclass()
+ negasciirange()
+ negset()
+ */
+}
+
+const asciiclass = {
+ /* \D success */
+ testmatch("\\D", "x")
+ testmatch("\\D+", "xa!#^cs")
+
+ /* \D fail: end of ranges chars */
+ testmatch("\\D", "0")
+ testmatch("\\D", "9")
+ testmatch("\\D+", "a35x")
+ testmatch("\\D+", "13688")
+
+ /* \X success */
+ testmatch("\\X", "Z")
+ testmatch("\\X\\X", "gg")
+ /* \X fail */
+ testmatch("\\X", "a")
+ testmatch("\\X+", "zz13b8cDEf")
+
+ /* \S success */
+ testmatch("\\S", "a")
+ testmatch("\\S\\S", "i%")
+ testmatch("\\S+", "alskd690!#!!")
+
+ /* \S fail */
+ testmatch("\\S", " ")
+ testmatch("\\S\\S", "\t\n")
+ testmatch("\\S+", "\t \nkait")
+
+ /* word success */
+ testmatch("\\W+", "!%!^^@@!^")
+ /* word fail */
+ testmatch("\\W+", "a^#$bcABC0123_")
+
+ /* \H success */
+ testmatch("\\H", "\n")
+ testmatch("\\H\\H", "\n\r")
+ /* \H fail */
+ testmatch("\\H+", "\t \t.")
+ testmatch("\\H\\H", "\t ")
+ testmatch("\\H+", "\ta35 \t ")
+}
+
+const set = {
+ /* ranges: should succeed */
+ testmatch("[^a-z]*", "ABCD")
+ testmatch("[^a-zA-Z]*", "1234")
+ testmatch("[^a-zA-Z0-9_]*", "-^^-")
+ testmatch("[^abc]*", "d6d")
+ testmatch("[^a-zABC]*", "!^!!))#")
+
+ /* ranges: should fail */
+ testmatch("[^a-z]*", "abcd")
+ testmatch("[^a-zA-Z]*", "abCD")
+ testmatch("[^a-zA-Z0-9_]*", "_abCD018")
+ testmatch("[^abc]*", "abba")
+ testmatch("[^a-zABC]*", "abBa")
+}
--- a/test/regex-basic.myr
+++ /dev/null
@@ -1,31 +1,0 @@
-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>")
-}
--- a/test/regex-boundaries.myr
+++ /dev/null
@@ -1,17 +1,0 @@
-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 */
-}
--- a/test/regex-capture.myr
+++ /dev/null
@@ -1,9 +1,0 @@
-use "testmatch.use"
-
-const main = {
- testmatch("A(.*)", "Abc")
- testmatch("A(.*)e", "Abcde")
- testmatch("(a|b)+", "abab")
- testmatch("A(b(.*)d)e", "Abcde")
- testmatch("(a?)(a*)(a?)", "aaaa")
-}
--- a/test/regex-class.myr
+++ /dev/null
@@ -1,67 +1,0 @@
-use std
-
-use "testmatch.use"
-
-const main = {
- asciiclass()
- set()
- /*
- unicodeclass()
- negasciiclass()
- negasciirange()
- negset()
- */
-}
-
-const asciiclass = {
- /* \d success */
- testmatch("\\d", "1")
- testmatch("\\d\\d", "13")
- testmatch("\\d+", "13688")
- /* \d fail */
- testmatch("\\d", "x")
- testmatch("\\d\\d", "x3")
- testmatch("\\d+", "1368f")
-
- /* \x success */
- testmatch("\\x", "a")
- testmatch("\\x\\x", "1F")
- testmatch("\\x+", "13b8cDEf")
- /* \x fail */
- testmatch("\\x", "Z")
- testmatch("\\x\\x", "fg")
- testmatch("\\x+", "13b8cg")
-
- /* \s success */
- testmatch("\\s", " ")
- testmatch("\\s\\s", "\t\n")
- testmatch("\\s+", "\t\n\r \t")
- /* \s fail */
- testmatch("\\s", "a")
- testmatch("\\s\\s", "i\n")
- testmatch("\\s+", "\t\n\r.\t")
-
- /* word success */
- testmatch("\\w+", "abcABC0123_")
- /* word fail */
- testmatch("\\w+", "abcABC0123_.")
-
- /* \h success */
- testmatch("\\h", " ")
- testmatch("\\h\\h", "\t ")
- testmatch("\\h+", "\t \t ")
- /* \h fail */
- testmatch("\\h", "\n")
- testmatch("\\h\\h", "\t\r")
- testmatch("\\h+", "\t \t.")
-}
-
-const set = {
- /* ranges */
- testmatch("[a-z]*", "abcd")
- testmatch("[a-zA-Z]*", "abCD")
- testmatch("[a-zA-Z0-9_]*", "_abCD018")
-
- testmatch("[abc]*", "abba")
- testmatch("[a-zABC]*", "abBa")
-}
--- a/test/regex-failmatch.myr
+++ /dev/null
@@ -1,8 +1,0 @@
-use std
-use regex
-
-use "testmatch.use"
-
-const main = {
- testmatch(".*bcd", "Abc")
-}
--- a/test/regex-negclass.myr
+++ /dev/null
@@ -1,72 +1,0 @@
-use std
-
-use "testmatch.use"
-
-const main = {
- asciiclass()
- set()
- /*
- unicodeclass()
- negasciiclass()
- negasciirange()
- negset()
- */
-}
-
-const asciiclass = {
- /* \D success */
- testmatch("\\D", "x")
- testmatch("\\D+", "xa!#^cs")
-
- /* \D fail: end of ranges chars */
- testmatch("\\D", "0")
- testmatch("\\D", "9")
- testmatch("\\D+", "a35x")
- testmatch("\\D+", "13688")
-
- /* \X success */
- testmatch("\\X", "Z")
- testmatch("\\X\\X", "gg")
- /* \X fail */
- testmatch("\\X", "a")
- testmatch("\\X+", "zz13b8cDEf")
-
- /* \S success */
- testmatch("\\S", "a")
- testmatch("\\S\\S", "i%")
- testmatch("\\S+", "alskd690!#!!")
-
- /* \S fail */
- testmatch("\\S", " ")
- testmatch("\\S\\S", "\t\n")
- testmatch("\\S+", "\t \nkait")
-
- /* word success */
- testmatch("\\W+", "!%!^^@@!^")
- /* word fail */
- testmatch("\\W+", "a^#$bcABC0123_")
-
- /* \H success */
- testmatch("\\H", "\n")
- testmatch("\\H\\H", "\n\r")
- /* \H fail */
- testmatch("\\H+", "\t \t.")
- testmatch("\\H\\H", "\t ")
- testmatch("\\H+", "\ta35 \t ")
-}
-
-const set = {
- /* ranges: should succeed */
- testmatch("[^a-z]*", "ABCD")
- testmatch("[^a-zA-Z]*", "1234")
- testmatch("[^a-zA-Z0-9_]*", "-^^-")
- testmatch("[^abc]*", "d6d")
- testmatch("[^a-zABC]*", "!^!!))#")
-
- /* ranges: should fail */
- testmatch("[^a-z]*", "abcd")
- testmatch("[^a-zA-Z]*", "abCD")
- testmatch("[^a-zA-Z0-9_]*", "_abCD018")
- testmatch("[^abc]*", "abba")
- testmatch("[^a-zABC]*", "abBa")
-}
--- a/test/regex-unicode.myr
+++ /dev/null
@@ -1,12 +1,0 @@
-use std
-use regex
-
-use "testmatch.use"
-
-const main = {
- testmatch(".*bæc", "Abæc")
- testmatch("(\\p{L}*)bæc\\P{L}*", "Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
- /* test various syntaxen */
- testmatch("(\\pL*)bæc\\PL*", "Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
- testmatch("(\\p{Letter}*)bæc\\P{Uppercase_Letter}*", "Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
-}
--- a/test/tests
+++ b/test/tests
@@ -20,10 +20,10 @@
# result: Result value
# What we compare with. This should be self-
# evident.
-B regex-basic C
-B regex-boundaries C
-B regex-capture C
-B regex-class C
-B regex-failmatch C
-B regex-negclass C
-B regex-unicode C
+B basic C
+B boundaries C
+B capture C
+B class C
+B failmatch C
+B negclass C
+B unicode C
--- /dev/null
+++ b/test/unicode.myr
@@ -1,0 +1,12 @@
+use std
+use regex
+
+use "testmatch.use"
+
+const main = {
+ testmatch(".*bæc", "Abæc")
+ testmatch("(\\p{L}*)bæc\\P{L}*", "Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
+ /* test various syntaxen */
+ testmatch("(\\pL*)bæc\\PL*", "Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
+ testmatch("(\\p{Letter}*)bæc\\P{Uppercase_Letter}*", "Aabæc%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
+}