MCPcopy Index your code
hub / github.com/gavv/httpexpect / NotContains

Method NotContains

string.go:545–565  ·  view source on GitHub ↗

NotContains succeeds if string doesn't contain Go string as a substring. Example: str := NewString(t, "Hello") str.NotContains("bye")

(value string)

Source from the content-addressed store, hash-verified

543// str := NewString(t, "Hello")
544// str.NotContains("bye")
545func (s *String) NotContains(value string) *String {
546 opChain := s.chain.enter("NotContains()")
547 defer opChain.leave()
548
549 if opChain.failed() {
550 return s
551 }
552
553 if strings.Contains(s.value, value) {
554 opChain.fail(AssertionFailure{
555 Type: AssertNotContainsSubset,
556 Actual: &AssertionValue{s.value},
557 Expected: &AssertionValue{value},
558 Errors: []error{
559 errors.New("expected: string does not contain sub-string"),
560 },
561 })
562 }
563
564 return s
565}
566
567// ContainsFold succeeds if string contains given Go string as a substring after
568// applying Unicode case-folding (so it's a case-insensitive match).

Callers

nothing calls this directly

Calls 5

enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80
failMethod · 0.80
ContainsMethod · 0.45

Tested by

no test coverage detected