An example of testing non nil values
()
| 84 | |
| 85 | // An example of testing non nil values |
| 86 | func ExampleNotNil() { |
| 87 | notNil := &struct{ s string }{"not_nil"} |
| 88 | assert := assert.To(nil) |
| 89 | assert.For("not_nil equals nil").That(notNil).Equals(nil) |
| 90 | assert.For("not_nil does not equal nil").That(notNil).NotEquals(nil) |
| 91 | assert.For("not_nil deep equals nil").That(notNil).DeepEquals(nil) |
| 92 | assert.For("not_nil is nil").That(notNil).IsNil() |
| 93 | assert.For("not_nil is not nil").That(notNil).IsNotNil() |
| 94 | // Output: |
| 95 | // Error:not_nil equals nil |
| 96 | // Got &{not_nil} |
| 97 | // Expect == <nil> |
| 98 | // Error:not_nil deep equals nil |
| 99 | // nil ⟦&{s:not_nil}⟧ != ⟦<nil>⟧ |
| 100 | // Error:not_nil is nil |
| 101 | // Got &{not_nil} |
| 102 | // Expect == `nil` |
| 103 | } |
| 104 | |
| 105 | // An example of using value Equals |
| 106 | func ExampleValueEquals() { |