mirror of
https://github.com/rclone/rclone.git
synced 2025-06-30 22:23:52 +02:00
test: use T.TempDir
to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the test and all its subtests complete. Reference: https://pkg.go.dev/testing#T.TempDir Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
committed by
Nick Craig-Wood
parent
18c24014da
commit
8cf76f5e11
@ -15,8 +15,7 @@ import (
|
||||
|
||||
// Basic test from golang's os/path_test.go
|
||||
func TestMkdirAll(t *testing.T) {
|
||||
tmpDir, tidy := testDir(t)
|
||||
defer tidy()
|
||||
tmpDir := t.TempDir()
|
||||
|
||||
path := tmpDir + "/dir/./dir2"
|
||||
err := MkdirAll(path, 0777)
|
||||
@ -99,8 +98,7 @@ func checkMkdirAllSubdirs(t *testing.T, path string, valid bool, errormsg string
|
||||
|
||||
// Testing paths on existing drive
|
||||
func TestMkdirAllOnDrive(t *testing.T) {
|
||||
path, tidy := testDir(t)
|
||||
defer tidy()
|
||||
path := t.TempDir()
|
||||
|
||||
dir, err := os.Stat(path)
|
||||
require.NoError(t, err)
|
||||
|
Reference in New Issue
Block a user