(pool Pool, t *testing.T)
| 49 | } |
| 50 | |
| 51 | func poolTest(pool Pool, t *testing.T) { |
| 52 | buf, err := pool.Get() |
| 53 | if err != nil { |
| 54 | t.Error(err) |
| 55 | } |
| 56 | if n, err := buf.Write([]byte("hello world")); n != 10 { |
| 57 | t.Errorf("wrote incorrect amount") |
| 58 | } else if err == nil { |
| 59 | t.Errorf("should have been a shortwrite error here") |
| 60 | } |
| 61 | pool.Put(buf) |
| 62 | if buf.Len() > 0 { |
| 63 | t.Errorf("should have emptied the buffer") |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | func TestFilePool(t *testing.T) { |
| 68 | pool := NewFilePool(1024, "::~_bad_dir_~::") |
no test coverage detected
searching dependent graphs…