Scope candidate blob readers to validation
This commit is contained in:
@@ -38,6 +38,7 @@ func TestReadCandidateTreeUsesCapturedCommitAndEnumeratesGitEntries(t *testing.T
|
||||
if err != nil {
|
||||
t.Fatalf("ReadCandidateTree() error = %v", err)
|
||||
}
|
||||
cleanupCandidateTree(t, tree)
|
||||
entries := make(map[string]gitTreeEntry, len(tree.Entries()))
|
||||
for _, entry := range tree.Entries() {
|
||||
entries[entry.Path] = gitTreeEntry{mode: entry.Mode, kind: entry.Type, size: entry.Size, hasSize: entry.HasSize}
|
||||
@@ -77,6 +78,11 @@ func TestReadCandidateTreeUsesCapturedCommitAndEnumeratesGitEntries(t *testing.T
|
||||
}
|
||||
}
|
||||
|
||||
func cleanupCandidateTree(tb testing.TB, tree *CandidateTree) {
|
||||
tb.Helper()
|
||||
tb.Cleanup(func() { _ = tree.Close() })
|
||||
}
|
||||
|
||||
func TestReadCandidateTreePreservesGitProcessError(t *testing.T) {
|
||||
repository := newTreeRepository(t)
|
||||
_, err := ReadCandidateTree(context.Background(), repository, strings.Repeat("f", 40))
|
||||
|
||||
Reference in New Issue
Block a user