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

Function TestOdbForeach

odb_test.go:124–157  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

122}
123
124func TestOdbForeach(t *testing.T) {
125 t.Parallel()
126 repo := createTestRepo(t)
127 defer cleanupTestRepo(t, repo)
128
129 _, _ = seedTestRepo(t, repo)
130
131 odb, err := repo.Odb()
132 checkFatal(t, err)
133
134 expect := 3
135 count := 0
136 err = odb.ForEach(func(id *Oid) error {
137 count++
138 return nil
139 })
140
141 checkFatal(t, err)
142 if count != expect {
143 t.Fatalf("Expected %v objects, got %v", expect, count)
144 }
145
146 expect = 1
147 count = 0
148 to_return := errors.New("not really an error")
149 err = odb.ForEach(func(id *Oid) error {
150 count++
151 return to_return
152 })
153
154 if err != to_return {
155 t.Fatalf("Odb.ForEach() did not return the expected error, got %v", err)
156 }
157}
158
159func TestOdbWritepack(t *testing.T) {
160 t.Parallel()

Callers

nothing calls this directly

Calls 6

createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
seedTestRepoFunction · 0.85
checkFatalFunction · 0.85
OdbMethod · 0.80
ForEachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…