Prerequisite
// ConvertibleTo reports whether a value of the type is convertible to type u.
// Even if ConvertibleTo returns true, the conversion may still panic.
// For example, a slice of type []T is convertible to *[N]T,
// but the conversion will panic if its length is less than N.
ConvertibleTo(u Type) bool
Example
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestEqualValues(t *testing.T) {
a := []int{1, 2}
b := (*[3]int)(nil)
assert.EqualValues(t, a, b)
}
Result
=== RUN TestEqualValues
--- FAIL: TestEqualValues (0.00s)
panic: reflect: cannot convert slice with length 2 to pointer to array with length 3 [recovered]
panic: reflect: cannot convert slice with length 2 to pointer to array with length 3
P.S. Inspired by Antonboom/testifylint#88
Prerequisite
Example
Result
P.S. Inspired by Antonboom/testifylint#88