MCPcopy
hub / github.com/redis/go-redis / TestBytesToStringGC

Function TestBytesToStringGC

internal/util/unsafe_test.go:73–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

71}
72
73func TestBytesToStringGC(t *testing.T) {
74 var (
75 expect = t.Name()
76 x string
77 wg sync.WaitGroup
78 )
79
80 wg.Add(1)
81 go func() {
82 defer wg.Done()
83 tmp := append([]byte(nil), t.Name()...)
84 x = BytesToString(tmp)
85 }()
86 wg.Wait()
87
88 for i := 0; i < 100; i++ {
89 runtime.GC()
90 }
91
92 if !reflect.DeepEqual(expect, x) {
93 t.Errorf("Expected = %v, Got = %v", expect, x)
94 }
95}
96
97func TestStringToBytesGC(t *testing.T) {
98 var (

Callers

nothing calls this directly

Calls 5

WaitMethod · 0.80
GCMethod · 0.80
BytesToStringFunction · 0.70
NameMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected