mirror of
https://github.com/restic/restic.git
synced 2026-07-05 06:54:17 +00:00
test: use generics in Equal function signature
This simplifies comparing a typed value against nil. Previously it was necessary to case nil into the proper type.
This commit is contained in:
@@ -48,7 +48,7 @@ func OKs(tb testing.TB, errs []error) {
|
||||
|
||||
// Equals fails the test if exp is not equal to act.
|
||||
// msg is optional message to be printed, first param being format string and rest being arguments.
|
||||
func Equals(tb testing.TB, exp, act interface{}, msgs ...string) {
|
||||
func Equals[T any](tb testing.TB, exp, act T, msgs ...string) {
|
||||
tb.Helper()
|
||||
if !reflect.DeepEqual(exp, act) {
|
||||
var msgString string
|
||||
|
||||
Reference in New Issue
Block a user