aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/gob/codec_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/gob/codec_test.go')
-rw-r--r--src/encoding/gob/codec_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/encoding/gob/codec_test.go b/src/encoding/gob/codec_test.go
index 54c356c464..28cd6088af 100644
--- a/src/encoding/gob/codec_test.go
+++ b/src/encoding/gob/codec_test.go
@@ -1544,6 +1544,10 @@ type LargeSliceStruct struct {
S []StringPair
}
+type LargeSliceString struct {
+ S []string
+}
+
func testEncodeDecode(t *testing.T, in, out any) {
t.Helper()
var b bytes.Buffer
@@ -1592,4 +1596,14 @@ func TestLargeSlice(t *testing.T) {
rt := &LargeSliceStruct{}
testEncodeDecode(t, st, rt)
})
+ t.Run("string", func(t *testing.T) {
+ t.Parallel()
+ s := make([]string, 1<<21)
+ for i := range s {
+ s[i] = string(rune(i))
+ }
+ st := &LargeSliceString{S: s}
+ rt := &LargeSliceString{}
+ testEncodeDecode(t, st, rt)
+ })
}