(encode func(string) []byte, original string)
| 609 | } |
| 610 | |
| 611 | func roundTripsCorrectly(encode func(string) []byte, original string) bool { |
| 612 | // Encode using our encoder, decode using the standard library, and assert |
| 613 | // that we haven't lost any information. |
| 614 | encoded := encode(original) |
| 615 | |
| 616 | var decoded string |
| 617 | err := json.Unmarshal(encoded, &decoded) |
| 618 | if err != nil { |
| 619 | return false |
| 620 | } |
| 621 | return original == decoded |
| 622 | } |
| 623 | |
| 624 | func roundTripsCorrectlyString(original string) bool { |
| 625 | return roundTripsCorrectly(zapEncode((*jsonEncoder).safeAddString), original) |
no outgoing calls
no test coverage detected