1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-29 21:45:21 -05:00

remove dep of assert lib

This commit is contained in:
Darien Raymond
2019-02-10 15:02:28 +01:00
parent a84897b4b6
commit 98950d5ada
14 changed files with 416 additions and 326 deletions

View File

@@ -8,12 +8,9 @@ import (
"v2ray.com/core/common"
"v2ray.com/core/common/buf"
. "v2ray.com/core/common/crypto"
. "v2ray.com/ext/assert"
)
func TestChunkStreamIO(t *testing.T) {
assert := With(t)
cache := bytes.NewBuffer(make([]byte, 0, 8192))
writer := NewChunkStreamWriter(PlainChunkSizeParser{}, cache)
@@ -36,14 +33,19 @@ func TestChunkStreamIO(t *testing.T) {
mb, err := reader.ReadMultiBuffer()
common.Must(err)
assert(mb.Len(), Equals, int32(4))
assert(mb[0].Bytes(), Equals, []byte("abcd"))
if s := mb.String(); s != "abcd" {
t.Error("content: ", s)
}
mb, err = reader.ReadMultiBuffer()
common.Must(err)
assert(mb.Len(), Equals, int32(3))
assert(mb[0].Bytes(), Equals, []byte("efg"))
if s := mb.String(); s != "efg" {
t.Error("content: ", s)
}
_, err = reader.ReadMultiBuffer()
assert(err, Equals, io.EOF)
if err != io.EOF {
t.Error("error: ", err)
}
}