2022-01-26 17:23:55 -05:00
|
|
|
package httpserver
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"regexp"
|
|
|
|
|
|
|
|
|
|
gomock "github.com/golang/mock/gomock"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var _ Logger = (*testLogger)(nil)
|
|
|
|
|
|
|
|
|
|
type testLogger struct{}
|
|
|
|
|
|
2023-04-12 08:36:58 +00:00
|
|
|
func (t *testLogger) Info(string) {}
|
|
|
|
|
func (t *testLogger) Warn(string) {}
|
|
|
|
|
func (t *testLogger) Error(string) {}
|
2022-01-26 17:23:55 -05:00
|
|
|
|
|
|
|
|
var _ gomock.Matcher = (*regexMatcher)(nil)
|
|
|
|
|
|
|
|
|
|
type regexMatcher struct {
|
|
|
|
|
regexp *regexp.Regexp
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *regexMatcher) Matches(x interface{}) bool {
|
|
|
|
|
s, ok := x.(string)
|
|
|
|
|
if !ok {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
return r.regexp.MatchString(s)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (r *regexMatcher) String() string {
|
|
|
|
|
return "regular expression " + r.regexp.String()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newRegexMatcher(regex string) *regexMatcher {
|
|
|
|
|
return ®exMatcher{
|
|
|
|
|
regexp: regexp.MustCompile(regex),
|
|
|
|
|
}
|
|
|
|
|
}
|