MCPcopy Create free account
hub / github.com/libgit2/git2go / TestMain

Function TestMain

git_test.go:13–47  ·  view source on GitHub ↗
(m *testing.M)

Source from the content-addressed store, hash-verified

11)
12
13func TestMain(m *testing.M) {
14 if err := registerManagedHTTP(); err != nil {
15 panic(err)
16 }
17
18 ret := m.Run()
19
20 if err := unregisterManagedTransports(); err != nil {
21 panic(err)
22 }
23
24 // Ensure that we are not leaking any pointer handles.
25 pointerHandles.Lock()
26 if len(pointerHandles.handles) > 0 {
27 for h, ptr := range pointerHandles.handles {
28 fmt.Printf("%016p: %v %+v\n", h, reflect.TypeOf(ptr), ptr)
29 }
30 panic("pointer handle list not empty")
31 }
32 pointerHandles.Unlock()
33
34 // Or remote pointers.
35 remotePointers.Lock()
36 if len(remotePointers.pointers) > 0 {
37 for ptr, remote := range remotePointers.pointers {
38 fmt.Printf("%016p: %+v\n", ptr, remote)
39 }
40 panic("remote pointer list not empty")
41 }
42 remotePointers.Unlock()
43
44 Shutdown()
45
46 os.Exit(ret)
47}
48
49func cleanupTestRepo(t *testing.T, r *Repository) {
50 var err error

Callers

nothing calls this directly

Calls 3

registerManagedHTTPFunction · 0.85
ShutdownFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…