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

Method NotHasPrefix

string.go:659–679  ·  view source on GitHub ↗

NotHasPrefix succeeds if string doesn't have given Go string as prefix Example: str := NewString(t, "Hello World") str.NotHasPrefix("Bye")

(value string)

Source from the content-addressed store, hash-verified

657// str := NewString(t, "Hello World")
658// str.NotHasPrefix("Bye")
659func (s *String) NotHasPrefix(value string) *String {
660 opChain := s.chain.enter("NotHasPrefix()")
661 defer opChain.leave()
662
663 if opChain.failed() {
664 return s
665 }
666
667 if strings.HasPrefix(s.value, value) {
668 opChain.fail(AssertionFailure{
669 Type: AssertNotContainsSubset,
670 Actual: &AssertionValue{s.value},
671 Expected: &AssertionValue{value},
672 Errors: []error{
673 errors.New("expected: string doesn't have prefix"),
674 },
675 })
676 }
677
678 return s
679}
680
681// HasSuffix succeeds if string has given Go string as suffix
682//

Callers 2

TestString_FailedChainFunction · 0.80
TestString_HasPrefixFunction · 0.80

Calls 5

enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80
HasPrefixMethod · 0.80
failMethod · 0.80

Tested by 2

TestString_FailedChainFunction · 0.64
TestString_HasPrefixFunction · 0.64