Skip to content

Commit

Permalink
test: maybe fix Windows?
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Feb 2, 2024
1 parent e4ee01b commit 2afd9c7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ func expectAreEqual(t *testing.T, subject, actual, expect string) {
}
}

func TestMain(m *testing.M) {
m.Run()

for _, f := range filesToCleanup {
os.Remove(f)
}
}

func testCli(t *testing.T, tc cliTestCase) {
t.Helper()

Expand Down Expand Up @@ -1378,6 +1386,8 @@ func TestRun_Ignores(t *testing.T) {
}
}

var filesToCleanup []string

func setupConfigForUpdating(t *testing.T, path string, initial string, updated string) func() {
t.Helper()

Expand All @@ -1387,6 +1397,8 @@ func setupConfigForUpdating(t *testing.T, path string, initial string, updated s
t.Fatalf("could not create test file: %v", err)
}

filesToCleanup = append(filesToCleanup, path)

return func() {
t.Helper()

Expand Down

0 comments on commit 2afd9c7

Please sign in to comment.