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

Function TestString

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

Source from the content-addressed store, hash-verified

897}
898
899func TestString(t *testing.T) {
900 b := NewBufferRandom(32)
901 b.Melt()
902 s := b.String()
903 for i := range b.Bytes() {
904 b.Bytes()[i] = 'x'
905 if string(b.Bytes()) != s {
906 t.Error("string does not map same memory")
907 }
908 }
909 b.Destroy()
910 s = b.String()
911 if s != "" {
912 t.Error("string should be empty")
913 }
914 b = newNullBuffer()
915 if s != "" {
916 t.Error("string should be empty")
917 }
918}
919
920func TestUint16(t *testing.T) {
921 b := NewBuffer(32)

Callers

nothing calls this directly

Calls 6

NewBufferRandomFunction · 0.85
newNullBufferFunction · 0.85
StringMethod · 0.80
BytesMethod · 0.80
MeltMethod · 0.45
DestroyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…