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

Function EqualJSON

internal/is/is.go:150–167  ·  view source on GitHub ↗

EqualJSON asserts that the given strings are equal after unmarshaling as json.

(t *testing.T, expected, actual string)

Source from the content-addressed store, hash-verified

148
149// EqualJSON asserts that the given strings are equal after unmarshaling as json.
150func EqualJSON(t *testing.T, expected, actual string) bool {
151 t.Helper()
152
153 var em map[string]any
154 err := json.Unmarshal([]byte(expected), &em)
155 MustNoError(t, err)
156
157 var am map[string]any
158 err = json.Unmarshal([]byte(actual), &am)
159 MustNoError(t, err)
160
161 if !reflect.DeepEqual(em, am) {
162 errorf(t, expected, actual)
163 return false
164 }
165
166 return true
167}

Callers 8

TestMarshalFunction · 0.92
TestMarshalMetaFunction · 0.92
TestMarshalJSONAPIFunction · 0.92
TestMarshalLinksFunction · 0.92
TestMarshalFieldsFunction · 0.92
TestMarshalRelationshipsFunction · 0.92
TestMarshalClientModeFunction · 0.92

Calls 2

MustNoErrorFunction · 0.85
errorfFunction · 0.85

Tested by 8

TestMarshalFunction · 0.74
TestMarshalMetaFunction · 0.74
TestMarshalJSONAPIFunction · 0.74
TestMarshalLinksFunction · 0.74
TestMarshalFieldsFunction · 0.74
TestMarshalRelationshipsFunction · 0.74
TestMarshalClientModeFunction · 0.74