An example of testing partial string equality
()
| 35 | |
| 36 | // An example of testing partial string equality |
| 37 | func ExampleStringFragments() { |
| 38 | assert := assert.To(nil) |
| 39 | assert.For(`"abc" Contains "b"`).ThatString("abc").Contains("b") |
| 40 | assert.For(`"abc" Contains "d"`).ThatString("abc").Contains("d") |
| 41 | assert.For(`"abc" HasPrefix "a"`).ThatString("abc").HasPrefix("a") |
| 42 | assert.For(`"abc" HasPrefix "b"`).ThatString("abc").HasPrefix("b") |
| 43 | assert.For(`"abc" HasSuffix "c"`).ThatString("abc").HasSuffix("c") |
| 44 | assert.For(`"abc" HasSuffix "b"`).ThatString("abc").HasSuffix("b") |
| 45 | // Output: |
| 46 | // Error:"abc" Contains "d" |
| 47 | // Got `abc` |
| 48 | // Expect contains `d` |
| 49 | // Error:"abc" HasPrefix "b" |
| 50 | // Got `abc` |
| 51 | // Expect starts with `b` |
| 52 | // Error:"abc" HasSuffix "b" |
| 53 | // Got `abc` |
| 54 | // Expect ends with `b` |
| 55 | } |
| 56 | |
| 57 | // An example of testing non strings as strings |
| 58 | func ExampleStringTypes() { |
nothing calls this directly
no test coverage detected