Skip to content

Commit

Permalink
test: use T.TempDir instead of MkdirTemp (#1485)
Browse files Browse the repository at this point in the history
* test: use T.TempDir instead of MkdirTemp

* Fix test by adding reader.ff.Release()
  • Loading branch information
alexandear committed Feb 10, 2023
1 parent c0c5f9c commit 8dcbc41
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,7 @@ func TestServeFileSmallNoReadFrom(t *testing.T) {
t.Parallel()

teststr := "hello, world!"

tempdir, err := os.MkdirTemp("", "httpexpect")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tempdir)
tempdir := t.TempDir()

if err := os.WriteFile(
path.Join(tempdir, "hello"), []byte(teststr), 0666); err != nil {
Expand All @@ -176,6 +171,7 @@ func TestServeFileSmallNoReadFrom(t *testing.T) {
if !ok {
t.Fatal("expected fsSmallFileReader")
}
defer reader.ff.Release()

buf := bytes.NewBuffer(nil)

Expand Down

0 comments on commit 8dcbc41

Please sign in to comment.