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

Method TestDeferredAnnotatef

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

Source from the content-addressed store, hash-verified

77}
78
79func (*functionSuite) TestDeferredAnnotatef(c *gc.C) {
80 // NOTE: this test fails with gccgo
81 if runtime.Compiler == "gccgo" {
82 c.Skip("gccgo can't determine the location")
83 }
84 first := errors.New("first")
85 test := func() (err error) {
86 defer errors.DeferredAnnotatef(&err, "deferred %s", "annotate")
87 return first
88 }
89 err := test()
90 c.Assert(err.Error(), gc.Equals, "deferred annotate: first")
91 c.Assert(errors.Cause(err), gc.Equals, first)
92
93 err = nil
94 errors.DeferredAnnotatef(&err, "deferred %s", "annotate")
95 c.Assert(err, gc.IsNil)
96}
97
98func (*functionSuite) TestWrap(c *gc.C) {
99 first := errors.New("first")

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
DeferredAnnotatefFunction · 0.92
CauseFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected