Use T.TempDir for temporary dirs in tests (#3580)
This commit is contained in:
parent
25d79c4e16
commit
2f94adabb2
8 changed files with 28 additions and 40 deletions
|
|
@ -261,12 +261,11 @@ func TestFindLegacy(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestExtractName(t *testing.T) {
|
||||
tmpfile, err := ioutil.TempFile("", "gh-cli")
|
||||
tmpfile, err := ioutil.TempFile(t.TempDir(), "gh-cli")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
tmpfile.Close()
|
||||
defer os.Remove(tmpfile.Name())
|
||||
defer tmpfile.Close()
|
||||
|
||||
type args struct {
|
||||
filePath string
|
||||
|
|
@ -322,12 +321,11 @@ about: This is how you report bugs
|
|||
}
|
||||
|
||||
func TestExtractContents(t *testing.T) {
|
||||
tmpfile, err := ioutil.TempFile("", "gh-cli")
|
||||
tmpfile, err := ioutil.TempFile(t.TempDir(), "gh-cli")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
tmpfile.Close()
|
||||
defer os.Remove(tmpfile.Name())
|
||||
defer tmpfile.Close()
|
||||
|
||||
type args struct {
|
||||
filePath string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue