From da2476a803ec286c08c96c3b566de8347eca3bf5 Mon Sep 17 00:00:00 2001 From: Jonathan Amsterdam Date: Fri, 19 May 2023 07:51:36 -0400 Subject: [PATCH] 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 Run-TryBot: Jonathan Amsterdam TryBot-Result: Gopher Robot --- src/log/slog/json_handler_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/log/slog/json_handler_test.go b/src/log/slog/json_handler_test.go index 61078caec8..dcfd701dd4 100644 --- a/src/log/slog/json_handler_test.go +++ b/src/log/slog/json_handler_test.go @@ -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}]"`, "", + // \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),