@@ -3971,7 +3971,7 @@ func testUpdateExts(nhs ...testNameBasicHandle) {
39713971 sx (testSelfExtTyp , 78 , SelfExt )
39723972 sx (testSelfExt2Typ , 79 , SelfExt )
39733973 sx (wrapBytesTyp , 32 , & tBytesExt )
3974-
3974+
39753975 // binc, cbor and json are not good fits for this generalized extension.
39763976 // this is because
39773977 // - json: will base64 encode a byte into a string, but we don't know the bytesFmt used
@@ -3981,7 +3981,7 @@ func testUpdateExts(nhs ...testNameBasicHandle) {
39813981 default :
39823982 sx (testUintToBytesTyp , 33 , & tUintToBytesExt )
39833983 }
3984-
3984+
39853985 // Now, add extensions for the type wrapInt64 and wrapBytes,
39863986 // so we can execute the Encode/Decode Ext paths.
39873987 if nh .n == "simple" {
@@ -4184,38 +4184,36 @@ func testEqualH(v1, v2 interface{}, h Handle) (err error) {
41844184// }
41854185// }
41864186
4187- func doTestLargeStruct ( t * testing. T , h Handle ) {
4187+ const testLargeStructSize = 65536
41884188
4189- const size = 65536
4190-
4191- type LargeStruct struct {
4192- A [size ]string
4193- B [size ]int
4194- C [size ]string
4195- }
4189+ type testLargeStruct struct {
4190+ A [testLargeStructSize ]string
4191+ B [testLargeStructSize ]int
4192+ C [testLargeStructSize ]string
4193+ }
41964194
4197- a := new (LargeStruct )
4198- b := new (LargeStruct )
4195+ var testLargeStructA , testLargeStructB testLargeStruct
41994196
4197+ func init () {
4198+ a := & testLargeStructA
42004199 for i := range a .A {
42014200 a .A [i ] = fmt .Sprintf ("a-%d" , i )
42024201 a .B [i ] = i
42034202 a .C [i ] = fmt .Sprintf ("c-%d" , i )
42044203 }
4204+ }
42054205
4206- var buf []byte
4207- err := NewEncoderBytes (& buf , h ).Encode (a )
4208- if err != nil {
4209- t .Fatal (err )
4210- }
4211-
4212- err = NewDecoderBytes (buf , h ).Decode (b )
4213- if err != nil {
4214- t .Fatal (err )
4206+ func doTestLargeStruct (t * testing.T , h Handle ) {
4207+ defer testSetup2 (t , & h )()
4208+ if testv .UseParallel {
4209+ t .Skip (testSkipParallelTestsMsg )
42154210 }
42164211
4217- if ! reflect . DeepEqual ( a , b ) {
4218- t . Error ( "a != b" )
4219- }
4212+ a := & testLargeStructA
4213+ b := & testLargeStructB
4214+ * b = testLargeStruct { }
42204215
4216+ buf := testMarshalErr (a , h , t , "large-struct-A" )
4217+ testUnmarshalErr (b , buf , h , t , "large-struct-B" )
4218+ testDeepEqualErr (a , b , t , "large-struct-A-B-compare" )
42214219}
0 commit comments