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

Function TestTransport

transport_test.go:43–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestTransport(t *testing.T) {
44 t.Parallel()
45 repo := createTestRepo(t)
46 defer cleanupTestRepo(t, repo)
47
48 callback := func(remote *Remote, transport *Transport) (SmartSubtransport, error) {
49 return &testSmartSubtransport{}, nil
50 }
51 registeredSmartTransport, err := NewRegisteredSmartTransport("foo", true, callback)
52 checkFatal(t, err)
53 defer registeredSmartTransport.Free()
54
55 remote, err := repo.Remotes.Create("test", "foo://bar")
56 checkFatal(t, err)
57 defer remote.Free()
58
59 err = remote.ConnectFetch(nil, nil, nil)
60 checkFatal(t, err)
61
62 remoteHeads, err := remote.Ls()
63 checkFatal(t, err)
64
65 expectedRemoteHeads := []RemoteHead{
66 {&Oid{}, "HEAD"},
67 {&Oid{}, "refs/heads/master"},
68 }
69 if !reflect.DeepEqual(expectedRemoteHeads, remoteHeads) {
70 t.Errorf("mismatched remote heads. expected %v, got %v", expectedRemoteHeads, remoteHeads)
71 }
72}

Callers

nothing calls this directly

Calls 9

FreeMethod · 0.95
createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
checkFatalFunction · 0.85
ConnectFetchMethod · 0.80
LsMethod · 0.80
FreeMethod · 0.65
CreateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…