This test demonstrates that Is() returns true if passed the same error reference twice, and that errors that are structurally different appear different via Is().
(t *testing.T)
| 33 | // error reference twice, and that errors that are structurally |
| 34 | // different appear different via Is(). |
| 35 | func TestLocalErrorEquivalence(t *testing.T) { |
| 36 | tt := testutils.T{T: t} |
| 37 | |
| 38 | err1 := errors.New("hello") |
| 39 | err2 := errors.New("world") |
| 40 | var nilErr error |
| 41 | |
| 42 | tt.Check(!markers.Is(err1, err2)) |
| 43 | tt.Check(markers.Is(err1, err1)) |
| 44 | tt.Check(markers.Is(err2, err2)) |
| 45 | tt.Check(!markers.Is(err1, nilErr)) |
| 46 | tt.Check(markers.Is(nilErr, nilErr)) |
| 47 | tt.Check(!markers.Is(nilErr, err1)) |
| 48 | } |
| 49 | |
| 50 | // This test demonstrates that Is() returns true if |
| 51 | // two errors are structurally equivalent. |