(t *testing.T)
| 23 | ) |
| 24 | |
| 25 | func TestJoin(t *testing.T) { |
| 26 | e := Join(errors.New("abc123"), errors.New("def456")) |
| 27 | expected := "abc123\ndef456" |
| 28 | if e.Error() != expected { |
| 29 | t.Errorf("Expected: %s; Got: %s", expected, e.Error()) |
| 30 | } |
| 31 | |
| 32 | e = Join(errors.New("abc123"), nil, errors.New("def456"), nil) |
| 33 | if e.Error() != expected { |
| 34 | t.Errorf("Expected: %s; Got: %s", expected, e.Error()) |
| 35 | } |
| 36 | |
| 37 | e = Join(nil, nil, nil) |
| 38 | if e != nil { |
| 39 | t.Errorf("expected nil error") |
| 40 | } |
| 41 | |
| 42 | e = Join( |
| 43 | errors.New("information"), |
| 44 | safedetails.WithSafeDetails(errors.New("detailed error"), "trace_id: %d", redact.Safe(1234)), |
| 45 | ) |
| 46 | printed := redact.Sprintf("%+v", e) |
| 47 | expectedR := redact.RedactableString(`‹information› |
| 48 | (1) ‹information› |
| 49 | | ‹detailed error› |
| 50 | Wraps: (2) trace_id: 1234 |
| 51 | └─ Wraps: (3) ‹detailed error› |
| 52 | Wraps: (4) ‹information› |
| 53 | Error types: (1) *join.joinError (2) *safedetails.withSafeDetails (3) *errors.errorString (4) *errors.errorString`) |
| 54 | if printed != expectedR { |
| 55 | t.Errorf("Expected: %s; Got: %s", expectedR, printed) |
| 56 | } |
| 57 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…