MCPcopy Create free account
hub / github.com/djherbis/buffer / poolTest

Function poolTest

buffer_test.go:51–65  ·  view source on GitHub ↗
(pool Pool, t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func 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
67func TestFilePool(t *testing.T) {
68 pool := NewFilePool(1024, "::~_bad_dir_~::")

Callers 1

TestMemPoolFunction · 0.85

Calls 4

GetMethod · 0.65
PutMethod · 0.65
LenMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…