test: replace defer cleanup with t.Cleanup
Reference: https://pkg.go.dev/testing#T.Cleanup Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
parent
be783a1856
commit
8e507075d1
34 changed files with 217 additions and 555 deletions
|
@ -11,8 +11,7 @@ import (
|
|||
)
|
||||
|
||||
func TestDirHandleMethods(t *testing.T) {
|
||||
_, _, dir, _, cleanup := dirCreate(t)
|
||||
defer cleanup()
|
||||
_, _, dir, _ := dirCreate(t)
|
||||
|
||||
h, err := dir.Open(os.O_RDONLY)
|
||||
require.NoError(t, err)
|
||||
|
@ -38,8 +37,7 @@ func TestDirHandleMethods(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDirHandleReaddir(t *testing.T) {
|
||||
r, vfs, cleanup := newTestVFS(t)
|
||||
defer cleanup()
|
||||
r, vfs := newTestVFS(t)
|
||||
|
||||
file1 := r.WriteObject(context.Background(), "dir/file1", "file1 contents", t1)
|
||||
file2 := r.WriteObject(context.Background(), "dir/file2", "file2- contents", t2)
|
||||
|
@ -93,8 +91,7 @@ func TestDirHandleReaddir(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDirHandleReaddirnames(t *testing.T) {
|
||||
_, _, dir, _, cleanup := dirCreate(t)
|
||||
defer cleanup()
|
||||
_, _, dir, _ := dirCreate(t)
|
||||
|
||||
fh, err := dir.Open(os.O_RDONLY)
|
||||
require.NoError(t, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue