NotHasPrefix succeeds if string doesn't have given Go string as prefix Example: str := NewString(t, "Hello World") str.NotHasPrefix("Bye")
(value string)
| 657 | // str := NewString(t, "Hello World") |
| 658 | // str.NotHasPrefix("Bye") |
| 659 | func (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 | // |