-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
Description
Description
Hello, team!
I was surprised, but testify allows to set non-string in msgAndArgs... if this is the single argument:
Lines 290 to 296 in 89cbdd9
| if len(msgAndArgs) == 1 { | |
| msg := msgAndArgs[0] | |
| if msgAsStr, ok := msg.(string); ok { | |
| return msgAsStr | |
| } | |
| return fmt.Sprintf("%+v", msg) | |
| } |
So I can do
assert.Equal(a, b, new(time.Time))But cannot
assert.Equal(a, b, new(time.Time), 1, 2, 3) // Panics.Proposed solution
Remove support of non-string single arg (as rare and strange? case) and allows only msg string + args ...any.
Use case
f-assertions future (#1089 (comment)).