1
0
mirror of https://github.com/golang/go synced 2024-09-29 01:24:34 -06:00

log/slog: improve test coverage of JSON handler

Change-Id: I31e96fc1329bb17937974ed3dbfda3448e53d37e
Reviewed-on: https://go-review.googlesource.com/c/go/+/495978
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Jonathan Amsterdam 2023-05-19 07:51:36 -04:00
parent b66474e021
commit da2476a803

View File

@ -76,9 +76,12 @@ func (jsonMarshalerError) Error() string { return "oops" }
func TestAppendJSONValue(t *testing.T) {
// jsonAppendAttrValue should always agree with json.Marshal.
for _, value := range []any{
"hello",
"hello\r\n\t\a",
`"[{escape}]"`,
"<escapeHTML&>",
// \u2028\u2029 is an edge case in JavaScript vs JSON.
// \xF6 is an incomplete encoding.
"\u03B8\u2028\u2029\uFFFF\xF6",
`-123`,
int64(-9_200_123_456_789_123_456),
uint64(9_200_123_456_789_123_456),