mirror of
https://github.com/restic/restic.git
synced 2025-12-03 22:11:47 +00:00
test: Use testing.T.Cleanup to remove tempdirs
This commit is contained in:
6
internal/cache/testing.go
vendored
6
internal/cache/testing.go
vendored
@@ -9,12 +9,12 @@ import (
|
||||
|
||||
// TestNewCache returns a cache in a temporary directory which is removed when
|
||||
// cleanup is called.
|
||||
func TestNewCache(t testing.TB) (*Cache, func()) {
|
||||
dir, cleanup := test.TempDir(t)
|
||||
func TestNewCache(t testing.TB) *Cache {
|
||||
dir := test.TempDir(t)
|
||||
t.Logf("created new cache at %v", dir)
|
||||
cache, err := New(restic.NewRandomID().String(), dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return cache, cleanup
|
||||
return cache
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user