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

Function TestMarkerDrivenDifference

markers/markers_test.go:390–408  ·  view source on GitHub ↗

This test demonstrates that two errors that are structurally equivalent can be made to become non-equivalent through markers.Is() by using markers.

(t *testing.T)

Source from the content-addressed store, hash-verified

388// equivalent can be made to become non-equivalent through markers.Is()
389// by using markers.
390func TestMarkerDrivenDifference(t *testing.T) {
391 tt := testutils.T{T: t}
392
393 err1 := errors.New("hello")
394 err2 := errors.New("hello")
395
396 tt.Check(markers.Is(err1, err2))
397
398 m1 := errors.New("m1")
399 m2 := errors.New("m2")
400
401 err1w := markers.Mark(err1, m1)
402 err2w := markers.Mark(err2, m2)
403
404 tt.Check(markers.Is(err1w, m1))
405 tt.Check(markers.Is(err2w, m2))
406
407 tt.Check(!markers.Is(err1w, err2w))
408}
409
410// This test demonstrates that error differences introduced
411// via Mark() are preserved across the network.

Callers

nothing calls this directly

Calls 3

CheckMethod · 0.95
IsFunction · 0.92
MarkFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…