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

Method HasPrefixFold

string.go:744–764  ·  view source on GitHub ↗

HasPrefixFold succeeds if string has given Go string as prefix after applying Unicode case-folding (so it's a case-insensitive match). Example: str := NewString(t, "Hello World") str.HasPrefixFold("hello")

(value string)

Source from the content-addressed store, hash-verified

742// str := NewString(t, "Hello World")
743// str.HasPrefixFold("hello")
744func (s *String) HasPrefixFold(value string) *String {
745 opChain := s.chain.enter("HasPrefixFold()")
746 defer opChain.leave()
747
748 if opChain.failed() {
749 return s
750 }
751
752 if !strings.HasPrefix(strings.ToLower(s.value), strings.ToLower(value)) {
753 opChain.fail(AssertionFailure{
754 Type: AssertContainsSubset,
755 Actual: &AssertionValue{s.value},
756 Expected: &AssertionValue{value},
757 Errors: []error{
758 errors.New("expected: string has prefix (if folded)"),
759 },
760 })
761 }
762
763 return s
764}
765
766// NotHasPrefixFold succeeds if string doesn't have given Go string as prefix
767// after applying Unicode case-folding (so it's a case-insensitive match).

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