HasSuffixFold succeeds if string has given Go string as suffix after applying Unicode case-folding (so it's a case-insensitive match). Example: str := NewString(t, "Hello World") str.HasSuffixFold("world")
(value string)
| 800 | // str := NewString(t, "Hello World") |
| 801 | // str.HasSuffixFold("world") |
| 802 | func (s *String) HasSuffixFold(value string) *String { |
| 803 | opChain := s.chain.enter("HasSuffixFold()") |
| 804 | defer opChain.leave() |
| 805 | |
| 806 | if opChain.failed() { |
| 807 | return s |
| 808 | } |
| 809 | |
| 810 | if !strings.HasSuffix(strings.ToLower(s.value), strings.ToLower(value)) { |
| 811 | opChain.fail(AssertionFailure{ |
| 812 | Type: AssertContainsSubset, |
| 813 | Actual: &AssertionValue{s.value}, |
| 814 | Expected: &AssertionValue{value}, |
| 815 | Errors: []error{ |
| 816 | errors.New("expected: string has suffix (if folded)"), |
| 817 | }, |
| 818 | }) |
| 819 | } |
| 820 | |
| 821 | return s |
| 822 | } |
| 823 | |
| 824 | // NotHasSuffixFold succeeds if string doesn't have given Go string as suffix |
| 825 | // after applying Unicode case-folding (so it's a case-insensitive match). |