MCPcopy Create free account
hub / github.com/DataDog/jsonapi / TestErrorMarshalUnmarshal

Function TestErrorMarshalUnmarshal

errors_test.go:10–22  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestErrorMarshalUnmarshal(t *testing.T) {
11 t.Parallel()
12
13 expected := []byte(`{"id":"1","links":{"about":"A","type":"TY"},"status":"500","code":"C","title":"T","detail":"D","source":{"pointer":"PO","parameter":"PA","header":"H"},"meta":{"K":"V"}}`)
14
15 var e Error
16 err := json.Unmarshal(expected, &e)
17 is.MustNoError(t, err)
18
19 actual, err := json.Marshal(&e)
20 is.MustNoError(t, err)
21 is.EqualJSON(t, string(expected), string(actual))
22}

Callers

nothing calls this directly

Calls 2

MustNoErrorFunction · 0.92
EqualJSONFunction · 0.92

Tested by

no test coverage detected