Skip to content

Commit

Permalink
Use t.TempDir in interpreter and state tests
Browse files Browse the repository at this point in the history
Better guarantee that the directory gets cleaned up.
  • Loading branch information
wedaly committed Dec 24, 2023
1 parent f2c4d38 commit 6e7022e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion input/interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3142,7 +3142,7 @@ func TestInterpreterStateIntegration(t *testing.T) {

// Write the initial text to a temp file, which we will load into the editor.
// Append a final "\n" to the contents as the POSIX end-of-file indicator.
tmpFile, err := os.CreateTemp("", "")
tmpFile, err := os.CreateTemp(t.TempDir(), "")
require.NoError(t, err)
path := tmpFile.Name()
defer os.Remove(path)
Expand Down
2 changes: 1 addition & 1 deletion state/document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

func createTestFile(t *testing.T, contents string) (path string, cleanup func()) {
f, err := os.CreateTemp(os.TempDir(), "aretext-")
f, err := os.CreateTemp(t.TempDir(), "aretext-")
require.NoError(t, err)
defer f.Close()

Expand Down

0 comments on commit 6e7022e

Please sign in to comment.