MCPcopy
hub / github.com/IBM/sarama / generateRegexpChecker

Function generateRegexpChecker

mocks/async_producer_test.go:15–26  ·  view source on GitHub ↗
(re string)

Source from the content-addressed store, hash-verified

13)
14
15func generateRegexpChecker(re string) func([]byte) error {
16 return func(val []byte) error {
17 matched, err := regexp.MatchString(re, string(val))
18 if err != nil {
19 return errors.New("Error while trying to match the input message with the expected pattern: " + err.Error())
20 }
21 if !matched {
22 return fmt.Errorf("No match between input value \"%s\" and expected pattern \"%s\"", val, re)
23 }
24 return nil
25 }
26}
27
28type testReporterMock struct {
29 errors []string

Calls 2

ErrorMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected