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

Function TestReadBufferObjectRejectsTruncatedInBandData

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

Source from the content-addressed store, hash-verified

514}
515
516func TestReadBufferObjectRejectsTruncatedInBandData(t *testing.T) {
517 buf := NewByteBuffer(nil)
518 buf.WriteBool(true)
519 buf.WriteVarUint32(4)
520 buf.WriteBinary([]byte{1, 2})
521
522 ctx := NewReadContext(false)
523 ctx.SetData(buf.Bytes())
524
525 require.Nil(t, ctx.ReadBufferObject())
526 require.Error(t, ctx.CheckError())
527}
528
529func TestReadBufferObjectCopiesInBandDataFromStream(t *testing.T) {
530 data := []byte{1, 3, 10, 11, 12, 20, 21, 22, 23, 24, 25}

Callers

nothing calls this directly

Calls 10

WriteBoolMethod · 0.95
WriteVarUint32Method · 0.95
WriteBinaryMethod · 0.95
SetDataMethod · 0.95
BytesMethod · 0.95
ReadBufferObjectMethod · 0.95
CheckErrorMethod · 0.95
NewByteBufferFunction · 0.85
NewReadContextFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected