+
+ # examples array
+ echo 'var examples = []testing.InternalExample{ //'
+ # This doesn't work because we don't pick up the output.
+ #for i in $examples
+ #do
+ # j=$(localname $i)
+ # echo ' {"'$i'", '$j', ""},'
+ #done
+ echo '}'
+
+ # body
+ echo \
+'
+var matchPat string
+var matchRe *__regexp__.Regexp
+
+func matchString(pat, str string) (result bool, err error) {
+ if matchRe == nil || matchPat != pat {
+ matchPat = pat
+ matchRe, err = __regexp__.Compile(matchPat)
+ if err != nil {
+ return
+ }
+ }
+ return matchRe.MatchString(str), nil
+}
+
+func main() {
+ testing.Main(matchString, tests, benchmarks, examples)
+}'