A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/stretchr/testify/issues/1679 below:

Inconsistent nature of `messageFromMsgAndArgs` · Issue #1679 · stretchr/testify · GitHub

Description

Hello, team!

I was surprised, but testify allows to set non-string in msgAndArgs... if this is the single argument:

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)).


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4