MCPcopy Create free account
hub / github.com/apache/fory / TestReadBufferObjectCopiesInBandDataFromStream

Function TestReadBufferObjectCopiesInBandDataFromStream

go/fory/fory_test.go:529–541  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

527}
528
529func TestReadBufferObjectCopiesInBandDataFromStream(t *testing.T) {
530 data := []byte{1, 3, 10, 11, 12, 20, 21, 22, 23, 24, 25}
531 ctx := NewReadContext(false)
532 ctx.buffer.ResetWithReader(bytes.NewReader(data), 2)
533
534 buf := ctx.ReadBufferObject()
535 require.NoError(t, ctx.CheckError())
536 require.Equal(t, []byte{10, 11, 12}, buf.GetData())
537
538 ctx.buffer.Skip(6, ctx.Err())
539 require.NoError(t, ctx.CheckError())
540 require.Equal(t, []byte{10, 11, 12}, buf.GetData())
541}
542
543// TestSerializeZeroCopy is temporarily disabled during API refactoring
544// TODO: Re-enable when zero-copy serialization API is updated

Callers

nothing calls this directly

Calls 8

ReadBufferObjectMethod · 0.95
CheckErrorMethod · 0.95
ErrMethod · 0.95
NewReadContextFunction · 0.85
ResetWithReaderMethod · 0.80
GetDataMethod · 0.80
EqualMethod · 0.45
SkipMethod · 0.45

Tested by

no test coverage detected