(t *testing.T)
| 29 | ) |
| 30 | |
| 31 | func TestAssert(t *testing.T) { |
| 32 | tt := testutils.T{T: t} |
| 33 | |
| 34 | baseErr := errors.New("world") |
| 35 | err := errors.Wrap(assert.WithAssertionFailure(baseErr), "hello") |
| 36 | |
| 37 | tt.Check(markers.Is(err, baseErr)) |
| 38 | |
| 39 | tt.Check(assert.HasAssertionFailure(err)) |
| 40 | |
| 41 | if _, ok := markers.If(err, func(err error) (interface{}, bool) { return nil, assert.IsAssertionFailure(err) }); !ok { |
| 42 | t.Error("woops") |
| 43 | } |
| 44 | |
| 45 | tt.CheckEqual(err.Error(), "hello: world") |
| 46 | |
| 47 | enc := errbase.EncodeError(context.Background(), err) |
| 48 | newErr := errbase.DecodeError(context.Background(), enc) |
| 49 | |
| 50 | tt.Check(markers.Is(newErr, baseErr)) |
| 51 | |
| 52 | tt.Check(assert.HasAssertionFailure(newErr)) |
| 53 | |
| 54 | if _, ok := markers.If(newErr, func(err error) (interface{}, bool) { return nil, assert.IsAssertionFailure(err) }); !ok { |
| 55 | t.Error("woops") |
| 56 | } |
| 57 | |
| 58 | tt.CheckEqual(newErr.Error(), "hello: world") |
| 59 | } |
| 60 | |
| 61 | func TestFormat(t *testing.T) { |
| 62 | tt := testutils.T{t} |
nothing calls this directly
no test coverage detected
searching dependent graphs…