MCPcopy Create free account
hub / github.com/davecheney/pub / TestToJSONReturnsEmptyObjectForNilMap

Function TestToJSONReturnsEmptyObjectForNilMap

internal/to/json_test.go:34–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestToJSONReturnsEmptyObjectForNilMap(t *testing.T) {
35 require := require.New(t)
36
37 var m map[string]string = nil
38 var out mockResponseWriter
39 err := to.JSON(&out, m)
40 require.NoError(err)
41 require.Equal("{}", out.String())
42}
43
44func TestToJSONReturnsAnEmptyArrayForKeyWithNilSlice(t *testing.T) {
45 require := require.New(t)

Callers

nothing calls this directly

Calls 2

JSONFunction · 0.92
StringMethod · 0.80

Tested by

no test coverage detected