(t *testing.T)
| 503 | } |
| 504 | |
| 505 | func TestGrowOverflow(t *testing.T) { |
| 506 | defer func() { |
| 507 | if err := recover(); err != bytes.ErrTooLarge { |
| 508 | t.Errorf("after too-large Grow, recover() = %v; want %v", err, bytes.ErrTooLarge) |
| 509 | } |
| 510 | }() |
| 511 | |
| 512 | buf := NewBuffer(make([]byte, 1)) |
| 513 | const maxInt = int(^uint(0) >> 1) |
| 514 | buf.Grow(maxInt) |
| 515 | } |
| 516 | |
| 517 | // Was a bug: used to give EOF reading empty slice at EOF. |
| 518 | func TestReadEmptyAtEOF(t *testing.T) { |