MCPcopy Create free account
hub / github.com/juju/errors / TestWrapf

Method TestWrapf

functions_test.go:121–131  ·  view source on GitHub ↗
(c *gc.C)

Source from the content-addressed store, hash-verified

119}
120
121func (*functionSuite) TestWrapf(c *gc.C) {
122 first := errors.New("first")
123 firstLoc := errorLocationValue(c)
124 detailed := errors.New("detailed")
125 err := errors.Wrapf(first, detailed, "value %d", 42)
126 secondLoc := errorLocationValue(c)
127 c.Assert(err.Error(), gc.Equals, "value 42: detailed")
128 c.Assert(errors.Cause(err), gc.Equals, detailed)
129 c.Assert(errors.Details(err), Contains, firstLoc)
130 c.Assert(errors.Details(err), Contains, secondLoc)
131}
132
133func (*functionSuite) TestWrapfOfNil(c *gc.C) {
134 detailed := errors.New("detailed")

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
WrapfFunction · 0.92
CauseFunction · 0.92
DetailsFunction · 0.92
errorLocationValueFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected