mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-12-28 13:05:28 -05:00
don't copy leftoever if at head
This commit is contained in:
@@ -91,6 +91,8 @@ func TestAuthenticationReaderWriterPartial(t *testing.T) {
|
||||
AdditionalDataGenerator: &NoOpBytesGenerator{},
|
||||
}, cache)
|
||||
|
||||
writer.Write([]byte{'a', 'b', 'c', 'd'})
|
||||
|
||||
nBytes, err := writer.Write(payload)
|
||||
assert.Error(err).IsNil()
|
||||
assert.Int(nBytes).Equals(len(payload))
|
||||
@@ -120,6 +122,11 @@ func TestAuthenticationReaderWriterPartial(t *testing.T) {
|
||||
}, pr)
|
||||
|
||||
actualPayload := make([]byte, 7*1024)
|
||||
nBytes, err = reader.Read(actualPayload)
|
||||
assert.Error(err).IsNil()
|
||||
assert.Int(nBytes).Equals(4)
|
||||
assert.Bytes(actualPayload[:nBytes]).Equals([]byte{'a', 'b', 'c', 'd'})
|
||||
|
||||
nBytes, err = reader.Read(actualPayload)
|
||||
assert.Error(err).IsNil()
|
||||
assert.Int(nBytes).Equals(len(actualPayload))
|
||||
|
||||
Reference in New Issue
Block a user