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

Function TestIsInterface

markers/markers_test.go:459–472  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

457func (e *testError) foo() {}
458
459func TestIsInterface(t *testing.T) {
460 tt := testutils.T{T: t}
461 base := &testError{msg: "hmm"}
462 wrapped := pkgErr.Wrap(base, "boom")
463
464 tt.Check(markers.HasInterface(base, (*testErrorInterface)(nil)))
465 tt.Check(markers.HasInterface(wrapped, (*testErrorInterface)(nil)))
466
467 tt.Check(!markers.HasInterface(base, (*net.Error)(nil)))
468 tt.Check(!markers.HasInterface(wrapped, (*net.Error)(nil)))
469
470 // nil errors don't contain any interfaces, not even nil.
471 tt.Check(!markers.HasInterface(nil, (*net.Error)(nil)))
472}
473
474// This test is used in the RFC.
475func TestLocalLocalEquivalence(t *testing.T) {

Callers

nothing calls this directly

Calls 2

CheckMethod · 0.95
HasInterfaceFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…