Was a bug: used to give EOF reading empty slice at EOF.
(t *testing.T)
| 516 | |
| 517 | // Was a bug: used to give EOF reading empty slice at EOF. |
| 518 | func TestReadEmptyAtEOF(t *testing.T) { |
| 519 | b := new(Buffer) |
| 520 | slice := make([]byte, 0) |
| 521 | n, err := b.Read(slice) |
| 522 | if err != nil { |
| 523 | t.Errorf("read error: %v", err) |
| 524 | } |
| 525 | if n != 0 { |
| 526 | t.Errorf("wrong count; got %d want 0", n) |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | func TestUnreadByte(t *testing.T) { |
| 531 | b := new(Buffer) |