MCPcopy Create free account
hub / github.com/cockroachdb/errors / TestLocalErrorEquivalence

Function TestLocalErrorEquivalence

markers/markers_test.go:35–48  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

33// error reference twice, and that errors that are structurally
34// different appear different via Is().
35func 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.

Callers

nothing calls this directly

Calls 2

CheckMethod · 0.95
IsFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…