testify icon indicating copy to clipboard operation
testify copied to clipboard

Use %v when formatting objects in assert.Len

Open benjaminjkraft opened this issue 4 years ago • 1 comments

Summary

Fix assert.Len's error message for non-%sable values.

Details

It was using %s, which doesn't work if the thing being len'ed is not a []string or similar. For example, assert.Len(t, []int{1}, 0) says that [%!s(int=1)] should have 1 item(s), but has 0. Now it uses %v which will work for almost anything.

benjaminjkraft avatar Jun 02 '21 18:06 benjaminjkraft

@glesica @boyan-soubachov @mvdkleijn could someone please have a look at this one?

wwade avatar Nov 29 '22 00:11 wwade

@benjaminjkraft @k1ng440 @wwade Could you instead review #1485 which I plan to merge soon?

dolmen avatar Oct 31 '23 00:10 dolmen