MCPcopy Index your code
hub / github.com/google/go-github / testJSONMarshal

Function testJSONMarshal

github/github_test.go:247–252  ·  view source on GitHub ↗

testJSONMarshal tests both JSON marshaling and unmarshaling of a value by comparing the marshaled output with the expected JSON string. This is the recommended function for most use cases. It performs a round-trip test that ensures both marshaling (Go value to JSON) and unmarshaling (JSON to Go val

(t *testing.T, v T, want string, opts ...cmp.Option)

Source from the content-addressed store, hash-verified

245// It performs a round-trip test that ensures both marshaling (Go value to JSON)
246// and unmarshaling (JSON to Go value) work correctly and produce semantically equivalent results.
247func testJSONMarshal[T any](t *testing.T, v T, want string, opts ...cmp.Option) {
248 t.Helper()
249
250 testJSONMarshalOnly(t, v, want)
251 testJSONUnmarshalOnly(t, v, want, opts...)
252}
253
254// testJSONMarshalOnly tests JSON marshaling by comparing the marshaled output with the expected JSON string.
255//

Calls 2

testJSONMarshalOnlyFunction · 0.85
testJSONUnmarshalOnlyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…