Add "Test" prefix to backend test functions

This commit is contained in:
Alexander Neumann 2016-01-23 19:12:02 +01:00
parent e4f2e4a203
commit f05a32509e
13 changed files with 94 additions and 94 deletions

View file

@ -13,75 +13,75 @@ func TestLocalBackendCreate(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Create(t) test.TestCreate(t)
} }
func TestLocalBackendOpen(t *testing.T) { func TestLocalBackendOpen(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Open(t) test.TestOpen(t)
} }
func TestLocalBackendCreateWithConfig(t *testing.T) { func TestLocalBackendCreateWithConfig(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.CreateWithConfig(t) test.TestCreateWithConfig(t)
} }
func TestLocalBackendLocation(t *testing.T) { func TestLocalBackendLocation(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Location(t) test.TestLocation(t)
} }
func TestLocalBackendConfig(t *testing.T) { func TestLocalBackendConfig(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Config(t) test.TestConfig(t)
} }
func TestLocalBackendGetReader(t *testing.T) { func TestLocalBackendGetReader(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.GetReader(t) test.TestGetReader(t)
} }
func TestLocalBackendLoad(t *testing.T) { func TestLocalBackendLoad(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Load(t) test.TestLoad(t)
} }
func TestLocalBackendWrite(t *testing.T) { func TestLocalBackendWrite(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Write(t) test.TestWrite(t)
} }
func TestLocalBackendGeneric(t *testing.T) { func TestLocalBackendBackend(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Generic(t) test.TestBackend(t)
} }
func TestLocalBackendDelete(t *testing.T) { func TestLocalBackendDelete(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Delete(t) test.TestDelete(t)
} }
func TestLocalBackendCleanup(t *testing.T) { func TestLocalBackendCleanup(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Cleanup(t) test.TestCleanup(t)
} }

View file

@ -13,75 +13,75 @@ func TestMemBackendCreate(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Create(t) test.TestCreate(t)
} }
func TestMemBackendOpen(t *testing.T) { func TestMemBackendOpen(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Open(t) test.TestOpen(t)
} }
func TestMemBackendCreateWithConfig(t *testing.T) { func TestMemBackendCreateWithConfig(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.CreateWithConfig(t) test.TestCreateWithConfig(t)
} }
func TestMemBackendLocation(t *testing.T) { func TestMemBackendLocation(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Location(t) test.TestLocation(t)
} }
func TestMemBackendConfig(t *testing.T) { func TestMemBackendConfig(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Config(t) test.TestConfig(t)
} }
func TestMemBackendGetReader(t *testing.T) { func TestMemBackendGetReader(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.GetReader(t) test.TestGetReader(t)
} }
func TestMemBackendLoad(t *testing.T) { func TestMemBackendLoad(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Load(t) test.TestLoad(t)
} }
func TestMemBackendWrite(t *testing.T) { func TestMemBackendWrite(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Write(t) test.TestWrite(t)
} }
func TestMemBackendGeneric(t *testing.T) { func TestMemBackendBackend(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Generic(t) test.TestBackend(t)
} }
func TestMemBackendDelete(t *testing.T) { func TestMemBackendDelete(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Delete(t) test.TestDelete(t)
} }
func TestMemBackendCleanup(t *testing.T) { func TestMemBackendCleanup(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Cleanup(t) test.TestCleanup(t)
} }

View file

@ -13,75 +13,75 @@ func TestS3BackendCreate(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Create(t) test.TestCreate(t)
} }
func TestS3BackendOpen(t *testing.T) { func TestS3BackendOpen(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Open(t) test.TestOpen(t)
} }
func TestS3BackendCreateWithConfig(t *testing.T) { func TestS3BackendCreateWithConfig(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.CreateWithConfig(t) test.TestCreateWithConfig(t)
} }
func TestS3BackendLocation(t *testing.T) { func TestS3BackendLocation(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Location(t) test.TestLocation(t)
} }
func TestS3BackendConfig(t *testing.T) { func TestS3BackendConfig(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Config(t) test.TestConfig(t)
} }
func TestS3BackendGetReader(t *testing.T) { func TestS3BackendGetReader(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.GetReader(t) test.TestGetReader(t)
} }
func TestS3BackendLoad(t *testing.T) { func TestS3BackendLoad(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Load(t) test.TestLoad(t)
} }
func TestS3BackendWrite(t *testing.T) { func TestS3BackendWrite(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Write(t) test.TestWrite(t)
} }
func TestS3BackendGeneric(t *testing.T) { func TestS3BackendBackend(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Generic(t) test.TestBackend(t)
} }
func TestS3BackendDelete(t *testing.T) { func TestS3BackendDelete(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Delete(t) test.TestDelete(t)
} }
func TestS3BackendCleanup(t *testing.T) { func TestS3BackendCleanup(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Cleanup(t) test.TestCleanup(t)
} }

View file

@ -13,75 +13,75 @@ func TestSftpBackendCreate(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Create(t) test.TestCreate(t)
} }
func TestSftpBackendOpen(t *testing.T) { func TestSftpBackendOpen(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Open(t) test.TestOpen(t)
} }
func TestSftpBackendCreateWithConfig(t *testing.T) { func TestSftpBackendCreateWithConfig(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.CreateWithConfig(t) test.TestCreateWithConfig(t)
} }
func TestSftpBackendLocation(t *testing.T) { func TestSftpBackendLocation(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Location(t) test.TestLocation(t)
} }
func TestSftpBackendConfig(t *testing.T) { func TestSftpBackendConfig(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Config(t) test.TestConfig(t)
} }
func TestSftpBackendGetReader(t *testing.T) { func TestSftpBackendGetReader(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.GetReader(t) test.TestGetReader(t)
} }
func TestSftpBackendLoad(t *testing.T) { func TestSftpBackendLoad(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Load(t) test.TestLoad(t)
} }
func TestSftpBackendWrite(t *testing.T) { func TestSftpBackendWrite(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Write(t) test.TestWrite(t)
} }
func TestSftpBackendGeneric(t *testing.T) { func TestSftpBackendBackend(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Generic(t) test.TestBackend(t)
} }
func TestSftpBackendDelete(t *testing.T) { func TestSftpBackendDelete(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Delete(t) test.TestDelete(t)
} }
func TestSftpBackendCleanup(t *testing.T) { func TestSftpBackendCleanup(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Cleanup(t) test.TestCleanup(t)
} }

View file

@ -13,75 +13,75 @@ func TestTestBackendCreate(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Create(t) test.TestCreate(t)
} }
func TestTestBackendOpen(t *testing.T) { func TestTestBackendOpen(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Open(t) test.TestOpen(t)
} }
func TestTestBackendCreateWithConfig(t *testing.T) { func TestTestBackendCreateWithConfig(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.CreateWithConfig(t) test.TestCreateWithConfig(t)
} }
func TestTestBackendLocation(t *testing.T) { func TestTestBackendLocation(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Location(t) test.TestLocation(t)
} }
func TestTestBackendConfig(t *testing.T) { func TestTestBackendConfig(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Config(t) test.TestConfig(t)
} }
func TestTestBackendGetReader(t *testing.T) { func TestTestBackendGetReader(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.GetReader(t) test.TestGetReader(t)
} }
func TestTestBackendLoad(t *testing.T) { func TestTestBackendLoad(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Load(t) test.TestLoad(t)
} }
func TestTestBackendWrite(t *testing.T) { func TestTestBackendWrite(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Write(t) test.TestWrite(t)
} }
func TestTestBackendGeneric(t *testing.T) { func TestTestBackendBackend(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Generic(t) test.TestBackend(t)
} }
func TestTestBackendDelete(t *testing.T) { func TestTestBackendDelete(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Delete(t) test.TestDelete(t)
} }
func TestTestBackendCleanup(t *testing.T) { func TestTestBackendCleanup(t *testing.T) {
if SkipMessage != "" { if SkipMessage != "" {
t.Skip(SkipMessage) t.Skip(SkipMessage)
} }
test.Cleanup(t) test.TestCleanup(t)
} }

View file

@ -39,7 +39,7 @@ var SkipMessage string
{{ range $f := .Funcs }} {{ range $f := .Funcs }}
func Test{{ $prefix }}{{ $f }}(t *testing.T){ func Test{{ $prefix }}{{ $f }}(t *testing.T){
if SkipMessage != "" { t.Skip(SkipMessage) } if SkipMessage != "" { t.Skip(SkipMessage) }
test.{{ $f }}(t) test.Test{{ $f }}(t)
} }
{{ end }} {{ end }}
@ -60,7 +60,7 @@ func errx(err error) {
os.Exit(1) os.Exit(1)
} }
var funcRegex = regexp.MustCompile(`^func\s+([A-Z].*)\s*\(`) var funcRegex = regexp.MustCompile(`^func\s+Test(.+)\s*\(`)
func findTestFunctions() (funcs []string) { func findTestFunctions() (funcs []string) {
f, err := os.Open(*testFile) f, err := os.Open(*testFile)

View file

@ -70,8 +70,8 @@ func close(t testing.TB) {
but = nil but = nil
} }
// Create creates a backend. // TestCreate creates a backend.
func Create(t testing.TB) { func TestCreate(t testing.TB) {
if CreateFn == nil { if CreateFn == nil {
t.Fatalf("CreateFn not set!") t.Fatalf("CreateFn not set!")
} }
@ -90,8 +90,8 @@ func Create(t testing.TB) {
} }
} }
// Open opens a previously created backend. // TestOpen opens a previously created backend.
func Open(t testing.TB) { func TestOpen(t testing.TB) {
if OpenFn == nil { if OpenFn == nil {
t.Fatalf("OpenFn not set!") t.Fatalf("OpenFn not set!")
} }
@ -107,9 +107,9 @@ func Open(t testing.TB) {
} }
} }
// CreateWithConfig tests that creating a backend in a location which already // TestCreateWithConfig tests that creating a backend in a location which already
// has a config file fails. // has a config file fails.
func CreateWithConfig(t testing.TB) { func TestCreateWithConfig(t testing.TB) {
if CreateFn == nil { if CreateFn == nil {
t.Fatalf("CreateFn not set") t.Fatalf("CreateFn not set")
} }
@ -133,8 +133,8 @@ func CreateWithConfig(t testing.TB) {
} }
} }
// Location tests that a location string is returned. // TestLocation tests that a location string is returned.
func Location(t testing.TB) { func TestLocation(t testing.TB) {
b := open(t) b := open(t)
defer close(t) defer close(t)
@ -144,8 +144,8 @@ func Location(t testing.TB) {
} }
} }
// Config saves and loads a config from the backend. // TestConfig saves and loads a config from the backend.
func Config(t testing.TB) { func TestConfig(t testing.TB) {
b := open(t) b := open(t)
defer close(t) defer close(t)
@ -196,8 +196,8 @@ func Config(t testing.TB) {
} }
} }
// GetReader tests various ways the GetReader function can be called. // TestGetReader tests various ways the GetReader function can be called.
func GetReader(t testing.TB) { func TestGetReader(t testing.TB) {
b := open(t) b := open(t)
defer close(t) defer close(t)
@ -245,8 +245,8 @@ func GetReader(t testing.TB) {
OK(t, b.Remove(backend.Data, id.String())) OK(t, b.Remove(backend.Data, id.String()))
} }
// Load tests the backend's Load function. // TestLoad tests the backend's Load function.
func Load(t testing.TB) { func TestLoad(t testing.TB) {
b := open(t) b := open(t)
defer close(t) defer close(t)
@ -325,8 +325,8 @@ func Load(t testing.TB) {
OK(t, b.Remove(backend.Data, id.String())) OK(t, b.Remove(backend.Data, id.String()))
} }
// Write tests writing data to the backend. // TestWrite tests writing data to the backend.
func Write(t testing.TB) { func TestWrite(t testing.TB) {
b := open(t) b := open(t)
defer close(t) defer close(t)
@ -410,8 +410,8 @@ func read(t testing.TB, rd io.Reader, expectedData []byte) {
} }
} }
// Generic tests all functions of the backend. // TestBackend tests all functions of the backend.
func Generic(t testing.TB) { func TestBackend(t testing.TB) {
b := open(t) b := open(t)
defer close(t) defer close(t)
@ -523,7 +523,7 @@ func Generic(t testing.TB) {
} }
// remove content if requested // remove content if requested
if TestCleanup { if TestCleanupTempDirs {
for _, test := range testStrings { for _, test := range testStrings {
id, err := backend.ParseID(test.id) id, err := backend.ParseID(test.id)
OK(t, err) OK(t, err)
@ -541,8 +541,8 @@ func Generic(t testing.TB) {
} }
} }
// Delete tests the Delete function. // TestDelete tests the Delete function.
func Delete(t testing.TB) { func TestDelete(t testing.TB) {
b := open(t) b := open(t)
defer close(t) defer close(t)
@ -557,14 +557,14 @@ func Delete(t testing.TB) {
} }
} }
// Cleanup runs the cleanup function after all tests are run. // TestCleanup runs the cleanup function after all tests are run.
func Cleanup(t testing.TB) { func TestCleanup(t testing.TB) {
if CleanupFn == nil { if CleanupFn == nil {
t.Log("CleanupFn function not set") t.Log("CleanupFn function not set")
return return
} }
if !TestCleanup { if !TestCleanupTempDirs {
t.Logf("not cleaning up backend") t.Logf("not cleaning up backend")
return return
} }

View file

@ -60,7 +60,7 @@ func cmdMount(t testing.TB, global GlobalOptions, dir string, ready, done chan s
cmd := &CmdMount{global: &global, ready: ready, done: done} cmd := &CmdMount{global: &global, ready: ready, done: done}
OK(t, cmd.Execute([]string{dir})) OK(t, cmd.Execute([]string{dir}))
if TestCleanup { if TestCleanupTempDirs {
RemoveAll(t, dir) RemoveAll(t, dir)
} }
} }

View file

@ -178,7 +178,7 @@ func configureRestic(t testing.TB, cache, repo string) GlobalOptions {
} }
func cleanupTempdir(t testing.TB, tempdir string) { func cleanupTempdir(t testing.TB, tempdir string) {
if !TestCleanup { if !TestCleanupTempDirs {
t.Logf("leaving temporary directory %v used for test", tempdir) t.Logf("leaving temporary directory %v used for test", tempdir)
return return
} }
@ -209,7 +209,7 @@ func withTestEnvironment(t testing.TB, f func(*testEnvironment, GlobalOptions))
f(&env, configureRestic(t, env.cache, env.repo)) f(&env, configureRestic(t, env.cache, env.repo))
if !TestCleanup { if !TestCleanupTempDirs {
t.Logf("leaving temporary directory %v used for test", tempdir) t.Logf("leaving temporary directory %v used for test", tempdir)
return return
} }

View file

@ -145,7 +145,7 @@ func TestNodeRestoreAt(t *testing.T) {
OK(t, err) OK(t, err)
defer func() { defer func() {
if TestCleanup { if TestCleanupTempDirs {
RemoveAll(t, tempdir) RemoveAll(t, tempdir)
} else { } else {
t.Logf("leaving tempdir at %v", tempdir) t.Logf("leaving tempdir at %v", tempdir)

View file

@ -15,7 +15,7 @@ import (
var ( var (
TestPassword = getStringVar("RESTIC_TEST_PASSWORD", "geheim") TestPassword = getStringVar("RESTIC_TEST_PASSWORD", "geheim")
TestCleanup = getBoolVar("RESTIC_TEST_CLEANUP", true) TestCleanupTempDirs = getBoolVar("RESTIC_TEST_CLEANUP", true)
TestTempDir = getStringVar("RESTIC_TEST_TMPDIR", "") TestTempDir = getStringVar("RESTIC_TEST_TMPDIR", "")
RunIntegrationTest = getBoolVar("RESTIC_TEST_INTEGRATION", true) RunIntegrationTest = getBoolVar("RESTIC_TEST_INTEGRATION", true)
RunFuseTest = getBoolVar("RESTIC_TEST_FUSE", true) RunFuseTest = getBoolVar("RESTIC_TEST_FUSE", true)
@ -70,7 +70,7 @@ func SetupRepo() *repository.Repository {
} }
func TeardownRepo(repo *repository.Repository) { func TeardownRepo(repo *repository.Repository) {
if !TestCleanup { if !TestCleanupTempDirs {
l := repo.Backend().(*local.Local) l := repo.Backend().(*local.Local)
fmt.Printf("leaving local backend at %s\n", l.Location()) fmt.Printf("leaving local backend at %s\n", l.Location())
return return

View file

@ -158,7 +158,7 @@ func WithTestEnvironment(t testing.TB, repoFixture string, f func(repodir string
f(filepath.Join(tempdir, "repo")) f(filepath.Join(tempdir, "repo"))
if !TestCleanup { if !TestCleanupTempDirs {
t.Logf("leaving temporary directory %v used for test", tempdir) t.Logf("leaving temporary directory %v used for test", tempdir)
return return
} }

View file

@ -49,7 +49,7 @@ func createTempDir(t *testing.T) string {
func TestTree(t *testing.T) { func TestTree(t *testing.T) {
dir := createTempDir(t) dir := createTempDir(t)
defer func() { defer func() {
if TestCleanup { if TestCleanupTempDirs {
RemoveAll(t, dir) RemoveAll(t, dir)
} }
}() }()