(t *testing.T)
| 45 | } |
| 46 | |
| 47 | func 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 | |
| 60 | func TestJSONEscaping(t *testing.T) { |
| 61 | enc := &jsonEncoder{buf: bufferpool.Get()} |
nothing calls this directly
no test coverage detected