class test repeat matcher
pattern[character] make matcher(function[boolean, character] the predicate)
return procedure matcher[character, string] • new(repeat element[character] • new(the predicate, false), as string)
matcher[character, string] make pattern(boolean do match empty)
return repeat matcher[character, string, string] • new(sequence matcher[character, string] • new(matcher list, match procedure), do match empty, join list)
testcase test match()
assert the matcher("abc")
assert the matcher("AbCabc")
assert the matcher("AaaBbCccABC")
assert the matcher("AaaBbCccABCabc")
assert the matcher("AaaBBBCcc")
assert !the matcher("bac")
assert !the matcher("aabb")
assert !the matcher("aaca")
testcase test parse()
assert the matcher • parse("abc") == "-a-b-c"
assert the matcher • parse("AbC") == "-A-b-C"
assert the matcher • parse("AaaBbCcc") == "-Aaa-Bb-Ccc"
assert the matcher • parse("AaaBBBCcc") == "-Aaa-BBB-Ccc"
assert the matcher • parse("abcABC") == "-a-b-c/-A-B-C"
assert the matcher • parse("AbCaBc") == "-A-b-C/-a-B-c"
assert the matcher • parse("AABBCCabcABC") == "-AA-BB-CC/-a-b-c/-A-B-C"