(t *testing.T)
| 122 | } |
| 123 | |
| 124 | func 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 | |
| 159 | func TestOdbWritepack(t *testing.T) { |
| 160 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…