aboutsummaryrefslogtreecommitdiff
path: root/src/log
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2023-05-19 07:51:36 -0400
committerJonathan Amsterdam <jba@google.com>2023-05-22 19:05:49 +0000
commitda2476a803ec286c08c96c3b566de8347eca3bf5 (patch)
tree3d7530cc4fe61afe1b37db847559cf5e24668773 /src/log
parentb66474e0217145570fbc38d66b3f11af64586225 (diff)
downloadgo-da2476a803ec286c08c96c3b566de8347eca3bf5.tar.gz
go-da2476a803ec286c08c96c3b566de8347eca3bf5.zip
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>
Diffstat (limited to 'src/log')
-rw-r--r--src/log/slog/json_handler_test.go5
1 files changed, 4 insertions, 1 deletions
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}]"`,
"<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),