Add test.Helper, also works with Go 1.8

This commit is contained in:
Alexander Neumann
2018-03-30 22:49:49 +02:00
parent a472868e06
commit 0532f08048
4 changed files with 41 additions and 0 deletions

View File

@@ -42,6 +42,7 @@ const testChunkerPol = chunker.Pol(0x3DA3358B4DC173)
// password. If be is nil, an in-memory backend is used. A constant polynomial
// is used for the chunker and low-security test parameters.
func TestRepositoryWithBackend(t testing.TB, be restic.Backend) (r restic.Repository, cleanup func()) {
test.Helper(t).Helper()
TestUseLowSecurityKDFParameters(t)
restic.TestDisableCheckPolynomial(t)
@@ -70,6 +71,7 @@ func TestRepositoryWithBackend(t testing.TB, be restic.Backend) (r restic.Reposi
// a non-existing directory, a local backend is created there and this is used
// instead. The directory is not removed, but left there for inspection.
func TestRepository(t testing.TB) (r restic.Repository, cleanup func()) {
test.Helper(t).Helper()
dir := os.Getenv("RESTIC_TEST_REPO")
if dir != "" {
_, err := os.Stat(dir)