Rename unused testing parameter to _

The parameter is an additional marker that the test helper must only be
used for tests.
This commit is contained in:
Michael Eischer 2023-05-18 19:23:32 +02:00
parent 1514593f22
commit d1a5ec7839
6 changed files with 8 additions and 7 deletions

View File

@ -3,6 +3,6 @@ package retry
import "testing" import "testing"
// TestFastRetries reduces the initial retry delay to 1 millisecond // TestFastRetries reduces the initial retry delay to 1 millisecond
func TestFastRetries(t testing.TB) { func TestFastRetries(_ testing.TB) {
fastRetries = true fastRetries = true
} }

View File

@ -8,7 +8,7 @@ import (
// TestLogToStderr configures debug to log to stderr if not the debug log is // TestLogToStderr configures debug to log to stderr if not the debug log is
// not already configured and returns whether logging was enabled. // not already configured and returns whether logging was enabled.
func TestLogToStderr(t testing.TB) bool { func TestLogToStderr(_ testing.TB) bool {
if opts.isEnabled { if opts.isEnabled {
return false return false
} }
@ -17,7 +17,7 @@ func TestLogToStderr(t testing.TB) bool {
return true return true
} }
func TestDisableLog(t testing.TB) { func TestDisableLog(_ testing.TB) {
opts.logger = nil opts.logger = nil
opts.isEnabled = false opts.isEnabled = false
} }

View File

@ -34,7 +34,7 @@ func TestUseLowSecurityKDFParameters(t logger) {
} }
// TestBackend returns a fully configured in-memory backend. // TestBackend returns a fully configured in-memory backend.
func TestBackend(t testing.TB) restic.Backend { func TestBackend(_ testing.TB) restic.Backend {
return mem.New() return mem.New()
} }

View File

@ -209,7 +209,7 @@ func TestParseHandle(s string, t BlobType) BlobHandle {
} }
// TestSetSnapshotID sets the snapshot's ID. // TestSetSnapshotID sets the snapshot's ID.
func TestSetSnapshotID(t testing.TB, sn *Snapshot, id ID) { func TestSetSnapshotID(_ testing.TB, sn *Snapshot, id ID) {
sn.id = &id sn.id = &id
} }

View File

@ -59,7 +59,7 @@ func TestCounter(t *testing.T) {
t.Log("number of calls:", ncalls) t.Log("number of calls:", ncalls)
} }
func TestCounterNil(t *testing.T) { func TestCounterNil(_ *testing.T) {
// Shouldn't panic. // Shouldn't panic.
var c *progress.Counter var c *progress.Counter
c.Add(1) c.Add(1)

View File

@ -26,7 +26,8 @@ func TestUpdater(t *testing.T) {
test.Assert(t, ncalls > 0, "no progress was reported") test.Assert(t, ncalls > 0, "no progress was reported")
} }
func TestUpdaterStopTwice(t *testing.T) { func TestUpdaterStopTwice(_ *testing.T) {
// must not panic
c := progress.NewUpdater(0, func(runtime time.Duration, final bool) {}) c := progress.NewUpdater(0, func(runtime time.Duration, final bool) {})
c.Done() c.Done()
c.Done() c.Done()