MCPcopy
hub / github.com/uber-go/goleak / TestVerifyNone

Function TestVerifyNone

leaks_test.go:85–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

83}
84
85func TestVerifyNone(t *testing.T) {
86 t.Run("VerifyNone finds leaks", func(t *testing.T) {
87 ft := &fakeT{}
88 VerifyNone(ft)
89 require.Empty(t, ft.errors, "Expect no errors from VerifyNone")
90
91 bg := startBlockedG()
92 VerifyNone(ft, testOptions())
93 require.NotEmpty(t, ft.errors, "Expect errors from VerifyNone on leaked goroutine")
94 bg.unblock()
95 })
96
97 t.Run("cleanup registered callback should be called", func(t *testing.T) {
98 ft := &fakeT{}
99 cleanupCalled := false
100 VerifyNone(ft, Cleanup(func(c int) {
101 assert.Equal(t, 0, c)
102 cleanupCalled = true
103 }))
104 require.True(t, cleanupCalled, "expect cleanup registered callback to be called")
105 })
106}
107
108func TestIgnoreCurrent(t *testing.T) {
109 t.Run("Should ignore current", func(t *testing.T) {

Callers

nothing calls this directly

Calls 6

VerifyNoneFunction · 0.85
startBlockedGFunction · 0.85
testOptionsFunction · 0.85
CleanupFunction · 0.85
unblockMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…