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

Function TestSpill2

buffer_test.go:377–394  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

375}
376
377func TestSpill2(t *testing.T) {
378 buf := NewSpill(New(5), nil)
379
380 if buf.Cap() != math.MaxInt64 {
381 t.Errorf("cap isn't infinite")
382 }
383
384 towrite := []byte("Hello World")
385 m, _ := buf.Write(towrite)
386 if m != len(towrite) {
387 t.Errorf("failed to write all data: %d != %d", m, len(towrite))
388 }
389 data := make([]byte, 12)
390 n, _ := buf.Read(data)
391 if !bytes.Equal(data[:n], []byte("Hello")) {
392 t.Error("Read Failed. " + string(data[:n]))
393 }
394}
395
396func TestNoSpill(t *testing.T) {
397 buf := NewSpill(New(1024), nil)

Callers

nothing calls this directly

Calls 5

NewSpillFunction · 0.85
NewFunction · 0.85
CapMethod · 0.65
WriteMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…