| 15 | } |
| 16 | |
| 17 | func (self *TextMatcher) Contains(target string) *TextMatcher { |
| 18 | self.appendRule(matcherRule[string]{ |
| 19 | name: fmt.Sprintf("contains '%s'", target), |
| 20 | testFn: func(value string) (bool, string) { |
| 21 | // everything contains the empty string so we unconditionally return true here |
| 22 | if target == "" { |
| 23 | return true, "" |
| 24 | } |
| 25 | |
| 26 | return strings.Contains(value, target), fmt.Sprintf("Expected '%s' to be found in '%s'", target, value) |
| 27 | }, |
| 28 | }) |
| 29 | |
| 30 | return self |
| 31 | } |
| 32 | |
| 33 | func (self *TextMatcher) DoesNotContain(target string) *TextMatcher { |
| 34 | self.appendRule(matcherRule[string]{ |