ThatString returns an OnString for string based assertions. The untyped argument is converted to a string using fmt.Sprint, and the result supports string specific tests.
(value interface{})
| 29 | // ThatString returns an OnString for string based assertions. |
| 30 | // The untyped argument is converted to a string using fmt.Sprint, and the result supports string specific tests. |
| 31 | func (a Assertion) ThatString(value interface{}) OnString { |
| 32 | s := "" |
| 33 | switch v := value.(type) { |
| 34 | case string: |
| 35 | s = v |
| 36 | case []byte: |
| 37 | s = string(v) |
| 38 | default: |
| 39 | s = fmt.Sprint(value) |
| 40 | } |
| 41 | return OnString{Assertion: a, value: s} |
| 42 | } |
| 43 | |
| 44 | // Equals asserts that the supplied string is equal to the expected string. |
| 45 | func (o OnString) Equals(expect string) bool { |