Skip to content

Commit 04e31f8

Browse files
committed
git_sizer_test: use testing.T.Cleanup() rather than defer
Its semantics allow running subtests in parallel.
1 parent b706346 commit 04e31f8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

git_sizer_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func TestRefSelections(t *testing.T) {
126126

127127
// Create a test repo with one orphan commit per refname:
128128
repo := testutils.NewTestRepo(t, true, "ref-selection")
129-
defer repo.Remove(t)
129+
t.Cleanup(func() { repo.Remove(t) })
130130

131131
for _, p := range references {
132132
repo.CreateReferencedOrphan(t, p.refname)
@@ -306,7 +306,7 @@ func TestRefgroups(t *testing.T) {
306306

307307
// Create a test repo with one orphan commit per refname:
308308
repo := testutils.NewTestRepo(t, true, "refgroups")
309-
defer repo.Remove(t)
309+
t.Cleanup(func() { repo.Remove(t) })
310310

311311
for _, refname := range references {
312312
repo.CreateReferencedOrphan(t, refname)
@@ -535,7 +535,7 @@ func TestBomb(t *testing.T) {
535535
t.Parallel()
536536

537537
repo := testutils.NewTestRepo(t, true, "bomb")
538-
defer repo.Remove(t)
538+
t.Cleanup(func() { repo.Remove(t) })
539539

540540
newGitBomb(t, repo, 10, 10, "boom!\n")
541541

0 commit comments

Comments
 (0)