MCPcopy Index your code
hub / github.com/cockroachdb/errors / TestJoin

Function TestJoin

join/join_test.go:25–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func 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›
50Wraps: (2) trace_id: 1234
51└─ Wraps: (3) ‹detailed error›
52Wraps: (4) ‹information›
53Error 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}

Callers

nothing calls this directly

Calls 3

WithSafeDetailsFunction · 0.92
JoinFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…