Compare commits

..

1 Commits

Author SHA1 Message Date
Michel Couillard 80b6504c61
Merge b877ac2b1c into 711c6fe9ec 2024-02-14 19:09:11 -08:00
1 changed files with 8 additions and 12 deletions

View File

@ -2578,19 +2578,15 @@ func TestJSONString(t *testing.T) {
testJSONString(t, s)
testJSONString(t, "R\xfd\xfc\a!\x82eO\x16?_\x0f\x9ab\x1dr")
testJSONString(t, "_\xb9\v\xad\xb3|X!\xb6\xd9U&\xa4\x1a\x95\x04")
data, _ := json.Marshal("\b\f")
if (string(data) == "\"\\b\\f\"") {
// Go version 1.22+ encodes "\b" and "\f" correctly.
testJSONString(t, "\b\f")
rng := rand.New(rand.NewSource(time.Now().UnixNano()))
start := time.Now()
var buf [16]byte
for time.Since(start) < time.Second*2 {
if _, err := rng.Read(buf[:]); err != nil {
t.Fatal(err)
}
testJSONString(t, string(buf[:]))
testJSONString(t, "\b\f")
rng := rand.New(rand.NewSource(time.Now().UnixNano()))
start := time.Now()
var buf [16]byte
for time.Since(start) < time.Second*2 {
if _, err := rng.Read(buf[:]); err != nil {
t.Fatal(err)
}
testJSONString(t, string(buf[:]))
}
}