(encode func(*jsonEncoder, string))
| 595 | } |
| 596 | |
| 597 | func zapEncode(encode func(*jsonEncoder, string)) func(s string) []byte { |
| 598 | return func(s string) []byte { |
| 599 | enc := &jsonEncoder{buf: bufferpool.Get()} |
| 600 | // Escape and quote a string using our encoder. |
| 601 | var ret []byte |
| 602 | encode(enc, s) |
| 603 | ret = make([]byte, 0, enc.buf.Len()+2) |
| 604 | ret = append(ret, '"') |
| 605 | ret = append(ret, enc.buf.Bytes()...) |
| 606 | ret = append(ret, '"') |
| 607 | return ret |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | func roundTripsCorrectly(encode func(string) []byte, original string) bool { |
| 612 | // Encode using our encoder, decode using the standard library, and assert |
no test coverage detected