MCPcopy Create free account
hub / github.com/cloudflare/cfssl / TestMarshal

Function TestMarshal

errors/error_test.go:265–277  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

263}
264
265func TestMarshal(t *testing.T) {
266 msg := "Arbitrary error message"
267 err := Wrap(CertificateError, Unknown, errors.New(msg))
268 bytes, _ := json.Marshal(err)
269 var received Error
270 json.Unmarshal(bytes, &received)
271 if received.ErrorCode != int(CertificateError)+int(Unknown) {
272 t.Fatal("Error code construction failed.")
273 }
274 if received.Message != msg {
275 t.Fatal("Error message construction failed.")
276 }
277}
278
279func TestErrorString(t *testing.T) {
280 msg := "Arbitrary error message"

Callers

nothing calls this directly

Calls 2

WrapFunction · 0.85
NewMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…