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

Method HasSuffix

string.go:687–707  ·  view source on GitHub ↗

HasSuffix succeeds if string has given Go string as suffix Example: str := NewString(t, "Hello World") str.HasSuffix("World")

(value string)

Source from the content-addressed store, hash-verified

685// str := NewString(t, "Hello World")
686// str.HasSuffix("World")
687func (s *String) HasSuffix(value string) *String {
688 opChain := s.chain.enter("HasSuffix()")
689 defer opChain.leave()
690
691 if opChain.failed() {
692 return s
693 }
694
695 if !strings.HasSuffix(s.value, value) {
696 opChain.fail(AssertionFailure{
697 Type: AssertContainsSubset,
698 Actual: &AssertionValue{s.value},
699 Expected: &AssertionValue{value},
700 Errors: []error{
701 errors.New("expected: string has suffix"),
702 },
703 })
704 }
705
706 return s
707}
708
709// NotHasSuffix succeeds if string doesn't have given Go string as suffix
710//

Callers 6

TestString_FailedChainFunction · 0.80
TestString_HasSuffixFunction · 0.80
NotHasSuffixMethod · 0.80
HasSuffixFoldMethod · 0.80
NotHasSuffixFoldMethod · 0.80
TestFruitsFunction · 0.80

Calls 4

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

Tested by 3

TestString_FailedChainFunction · 0.64
TestString_HasSuffixFunction · 0.64
TestFruitsFunction · 0.64