MCPcopy
hub / github.com/awnumar/memguard / TestCopy

Function TestCopy

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

Source from the content-addressed store, hash-verified

565}
566
567func TestCopy(t *testing.T) {
568 b := NewBuffer(16)
569 if b == nil {
570 t.Error("buffer is nil")
571 }
572 b.Copy([]byte("yellow submarine"))
573 if !bytes.Equal(b.Bytes(), []byte("yellow submarine")) {
574 t.Error("copy unsuccessful")
575 }
576 b.Destroy()
577 b.Copy([]byte("yellow submarine"))
578 if b.Bytes() != nil {
579 t.Error("buffer should be destroyed")
580 }
581 b = newNullBuffer()
582 b.Copy([]byte("yellow submarine"))
583}
584
585func TestCopyAt(t *testing.T) {
586 b := NewBuffer(8)

Callers

nothing calls this directly

Calls 5

DestroyMethod · 0.95
newNullBufferFunction · 0.85
CopyMethod · 0.80
BytesMethod · 0.80
NewBufferFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…