@@ -133,7 +133,7 @@ func TestChain(t *testing.T) {
133133 var err error
134134 var remaining []byte
135135
136- remaining , val .err , err = decodeError (* p )
136+ remaining , val .err , err = decodeError (p . Bytes () )
137137 assert .NoError (t , err )
138138 assert .ErrorIs (t , val .err , test .err )
139139
@@ -229,7 +229,7 @@ func TestChain(t *testing.T) {
229229 encodeUint64 (p , test .num4 )
230230 encodeBool (p , test .truth )
231231 encodeNil (p )
232- remaining , val .err , err = decodeError (* p )
232+ remaining , val .err , err = decodeError (p . Bytes () )
233233 remaining , val .test , err = decodeString (remaining )
234234 remaining , val .b , err = decodeBytes (remaining , val .b )
235235 remaining , val .num1 , err = decodeUint8 (remaining )
@@ -286,7 +286,7 @@ func TestCompleteChain(t *testing.T) {
286286 val := new (testStruct )
287287 var err error
288288
289- d := GetDecoder (* p )
289+ d := GetDecoder (p . Bytes () )
290290
291291 val .err , err = d .Error ()
292292 assert .NoError (t , err )
@@ -375,7 +375,7 @@ func TestCompleteChain(t *testing.T) {
375375 p .Reset ()
376376 n := testing .AllocsPerRun (100 , func () {
377377 Encoder (p ).Error (test .err ).String (test .test ).Bytes (test .b ).Uint8 (test .num1 ).Uint16 (test .num2 ).Uint32 (test .num3 ).Uint64 (test .num4 ).Bool (test .truth ).Nil ()
378- d = GetDecoder (* p )
378+ d = GetDecoder (p . Bytes () )
379379 val .err , err = d .Error ()
380380 val .test , err = d .String ()
381381 val .b , err = d .Bytes (val .b )
@@ -396,7 +396,7 @@ func TestNilSlice(t *testing.T) {
396396 p := NewBuffer ()
397397 Encoder (p ).Slice (uint32 (len (s )), StringKind )
398398
399- d := GetDecoder (* p )
399+ d := GetDecoder (p . Bytes () )
400400 j , err := d .Slice (StringKind )
401401 assert .NoError (t , err )
402402 assert .Equal (t , uint32 (len (s )), j )
@@ -414,7 +414,7 @@ func TestError(t *testing.T) {
414414 p := NewBuffer ()
415415 Encoder (p ).Error (v )
416416
417- d := GetDecoder (* p )
417+ d := GetDecoder (p . Bytes () )
418418 _ , err := d .String ()
419419 assert .ErrorIs (t , err , InvalidString )
420420
@@ -424,3 +424,12 @@ func TestError(t *testing.T) {
424424
425425 d .Return ()
426426}
427+
428+ func TestLen (t * testing.T ) {
429+ t .Parallel ()
430+
431+ p := NewBuffer ()
432+ Encoder (p ).String ("Hello World" )
433+
434+ assert .Equal (t , 17 , p .Len ())
435+ }
0 commit comments