HasSuffix succeeds if string has given Go string as suffix Example: str := NewString(t, "Hello World") str.HasSuffix("World")
(value string)
| 685 | // str := NewString(t, "Hello World") |
| 686 | // str.HasSuffix("World") |
| 687 | func (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 | // |