MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / TestStandardLibraryErrors

Function TestStandardLibraryErrors

pkg/errors/std_test.go:26–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestStandardLibraryErrors(t *testing.T) {
27 t.Parallel()
28 a := assertions.New(t)
29
30 var (
31 d1 = errors.Define("test_std_1", "definition 1")
32 d2 = errors.Define("test_std_2", "definition 2")
33 d3 = errors.Define("test_std_3", "definition 3")
34 )
35
36 a.So(errors.Is(d1, d1), should.BeTrue)
37 a.So(errors.Is(d1, d2), should.BeFalse)
38
39 e := d1.WithCause(d2.WithCause(io.EOF))
40
41 a.So(errors.Is(e, d3), should.BeFalse)
42
43 a.So(errors.Is(e, d1), should.BeTrue)
44 a.So(errors.Is(e, d2), should.BeTrue)
45 a.So(errors.Is(e, io.EOF), should.BeTrue)
46}

Callers

nothing calls this directly

Calls 4

DefineFunction · 0.92
NewMethod · 0.65
IsMethod · 0.45
WithCauseMethod · 0.45

Tested by

no test coverage detected