We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi
package main import ( "github.com/stretchr/testify/assert" ) type Foo struct { Array [2]int } func main() { a := Foo{[2]int{1, 2}} b := Foo{[2]int{2, 1}} assert.EqualExportedValues(nil, a, b) }
Will panic with "panic: reflect.MakeSlice of non-slice type"
Reason is there in assertion.go:113 :
case reflect.Array, reflect.Slice: result := reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len())
reflect.MakeSlice only work with slice, not with Array. Fix could be follow:
case reflect.Array, reflect.Slice: result := reflect.New(expectedType).Elem() if expectedKind == reflect.Slice { result = reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len()) }
Or even carry reflect.Array to different switch case
The text was updated successfully, but these errors were encountered:
Confirmed. https://go.dev/play/p/0ZWBaOHwqjZ
Simpler: https://go.dev/play/p/Rxk9Z1Cvsx9
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Hi
Will panic with "panic: reflect.MakeSlice of non-slice type"
Reason is there in assertion.go:113 :
reflect.MakeSlice only work with slice, not with Array. Fix could be follow:
Or even carry reflect.Array to different switch case
The text was updated successfully, but these errors were encountered: