Skip to content

Commit

Permalink
move cleanup above err check
Browse files Browse the repository at this point in the history
  • Loading branch information
leohhhn committed Dec 21, 2023
1 parent 928801c commit 872fd12
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions extractor/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func TestFindFilePaths(t *testing.T) {
t.Parallel()

tempDir, err := os.MkdirTemp(".", "test")
require.NoError(t, err)
t.Cleanup(removeDir(t, tempDir))
require.NoError(t, err)

testFiles := make([]string, numSourceFiles)

Expand Down Expand Up @@ -109,8 +109,8 @@ func TestWritePackageMetadata(t *testing.T) {

// Make temp dir
tempDir, err := os.MkdirTemp(".", "test")
require.NoError(t, err)
t.Cleanup(removeDir(t, tempDir))
require.NoError(t, err)

for _, msg := range mockMsgsAddPackage {
md := metadataFromMsg(msg)
Expand Down Expand Up @@ -150,8 +150,8 @@ func TestWritePackageFiles(t *testing.T) {
_, mockMsgsAddPackage := generateMockMsgs(t)

tempDir, err := os.MkdirTemp(".", "test")
require.NoError(t, err)
t.Cleanup(removeDir(t, tempDir))
require.NoError(t, err)

for _, msg := range mockMsgsAddPackage {
// Get output dir
Expand Down Expand Up @@ -179,8 +179,8 @@ func generateSourceFiles(t *testing.T, mockMsgs []std.Msg) []string {
t.Helper()

tempDir, err := os.MkdirTemp(".", "test")
require.NoError(t, err)
t.Cleanup(removeDir(t, tempDir))
require.NoError(t, err)

var (
mockTx = make([]std.Tx, numTx)
Expand Down

0 comments on commit 872fd12

Please sign in to comment.