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

Method TestNewErr

error_test.go:142–154  ·  view source on GitHub ↗
(c *gc.C)

Source from the content-addressed store, hash-verified

140}
141
142func (*errorsSuite) TestNewErr(c *gc.C) {
143 if runtime.Compiler == "gccgo" {
144 c.Skip("gccgo can't determine the location")
145 }
146
147 err := errors.NewErr("testing %d", 42)
148 err.SetLocation(0)
149 locLine := errorLocationValue(c)
150
151 c.Assert(err.Error(), gc.Equals, "testing 42")
152 c.Assert(errors.Cause(&err), gc.Equals, &err)
153 c.Assert(errors.Details(&err), Contains, locLine)
154}
155
156func (*errorsSuite) TestNewErrWithCause(c *gc.C) {
157 if runtime.Compiler == "gccgo" {

Callers

nothing calls this directly

Calls 6

SetLocationMethod · 0.95
ErrorMethod · 0.95
NewErrFunction · 0.92
CauseFunction · 0.92
DetailsFunction · 0.92
errorLocationValueFunction · 0.85

Tested by

no test coverage detected