Skip to content
New issue

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

argMatches doesn't handle []byte properly #35

Closed
skriptble opened this issue Feb 25, 2016 · 1 comment
Closed

argMatches doesn't handle []byte properly #35

skriptble opened this issue Feb 25, 2016 · 1 comment

Comments

@skriptble
Copy link
Contributor

Line 352 of expectations.go causes a panic when the driver.Value is a slice of bytes because it is an uncomparable type:

panic: runtime error: comparing uncomparable type []uint8

This panic isn't recovered because it is called directly from sqlmock.Exec. A solution would be to use reflect.DeepEqual instead of using a != check. Another would be to check if either the dargs or the args[k] are slices of bytes and then user bytes.Equal, if not then default to the != check.

@l3pp4rd
Copy link
Member

l3pp4rd commented Feb 25, 2016

hi @skriptble could you submit a pull request? it seems to be important

skriptble added a commit to skriptble/go-sqlmock that referenced this issue Feb 25, 2016
Fixes the incorrect handling of []byte when comparing an argument
recieved from Exec or Query and the exepected value.

Closes DATA-DOG#35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants