MCPcopy
hub / github.com/uber-go/zap / TestJSONClone

Function TestJSONClone

zapcore/json_encoder_impl_test.go:47–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func TestJSONClone(t *testing.T) {
48 // The parent encoder is created with plenty of excess capacity.
49 parent := &jsonEncoder{buf: bufferpool.Get()}
50 clone := parent.Clone()
51
52 // Adding to the parent shouldn't affect the clone, and vice versa.
53 parent.AddString("foo", "bar")
54 clone.AddString("baz", "bing")
55
56 assertJSON(t, `"foo":"bar"`, parent)
57 assertJSON(t, `"baz":"bing"`, clone.(*jsonEncoder))
58}
59
60func TestJSONEscaping(t *testing.T) {
61 enc := &jsonEncoder{buf: bufferpool.Get()}

Callers

nothing calls this directly

Calls 5

CloneMethod · 0.95
AddStringMethod · 0.95
assertJSONFunction · 0.85
AddStringMethod · 0.65
GetMethod · 0.45

Tested by

no test coverage detected