(t *testing.T)
| 126 | } |
| 127 | |
| 128 | func TestIndexRemoveDirectory(t *testing.T) { |
| 129 | repo := createTestRepo(t) |
| 130 | defer cleanupTestRepo(t, repo) |
| 131 | |
| 132 | odb, err := repo.Odb() |
| 133 | checkFatal(t, err) |
| 134 | |
| 135 | blobID, err := odb.Write([]byte("fou\n"), ObjectBlob) |
| 136 | checkFatal(t, err) |
| 137 | |
| 138 | idx, err := NewIndex() |
| 139 | checkFatal(t, err) |
| 140 | |
| 141 | entryCount := idx.EntryCount() |
| 142 | if entryCount != 0 { |
| 143 | t.Fatal("Index should count 0 entry") |
| 144 | } |
| 145 | |
| 146 | entry := IndexEntry{ |
| 147 | Path: "path/to/LISEZ_MOI", |
| 148 | Id: blobID, |
| 149 | Mode: FilemodeBlob, |
| 150 | } |
| 151 | |
| 152 | err = idx.Add(&entry) |
| 153 | checkFatal(t, err) |
| 154 | |
| 155 | entryCount = idx.EntryCount() |
| 156 | if entryCount != 1 { |
| 157 | t.Fatal("Index should count 1 entry") |
| 158 | } |
| 159 | |
| 160 | err = idx.RemoveDirectory("path", 0) |
| 161 | |
| 162 | entryCount = idx.EntryCount() |
| 163 | if entryCount != 0 { |
| 164 | t.Fatal("Index should count 0 entry") |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | func TestIndexAddFromBuffer(t *testing.T) { |
| 169 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…