(t *testing.T)
| 29 | } |
| 30 | |
| 31 | func TestByteBufferUseTwice(t *testing.T) { |
| 32 | bytes := &ByteBuffer{quota: 10} |
| 33 | buf := bytes.Use(10) |
| 34 | if len(buf) != 10 || len(bytes.Bytes()) != 10 { |
| 35 | t.Error("第一次调用Use函数处理不正确") |
| 36 | } |
| 37 | bytes.SetQuota(30) |
| 38 | buf = bytes.Use(20) |
| 39 | if len(buf) != 20 || len(bytes.Bytes()) != 30 { |
| 40 | t.Error("第二次调用Use函数处理不正确") |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | func TestByteBufferReset(t *testing.T) { |
| 45 | bytes := &ByteBuffer{quota: 10} |