-
Notifications
You must be signed in to change notification settings - Fork 554
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
ShouldResemble fails on map[string]interface{} #437
Comments
I just ran into this as well:
|
Same here:
|
what about ?
which is the right assertion matcher to use? |
I've seen this too when asserting an object unmarshaled into a var obj map[string]interface{}
_ = json.Unmarshal([]byte(`{"a_number": 3}`), &obj)
fmt.Printf("%T\n", obj["a_number"]) // "float64"
So(obj, ShouldResemble, map[string]interface{}{"a_number": 3}) // fail
So(obj, ShouldResemble, map[string]interface{}{"a_number": 3.0}) // pass
So(obj, ShouldResemble, map[string]interface{}{"a_number": float64(3)}) // pass
This also affects eg using aliases for types, such as |
This issue is more related to the assertions package than to GoConvey so I've moved it there. |
@mdwhatcott that likely applies to #473 too |
Hi
I don't know if ShouldResemble is supposed to work there but I get this
My struct:
Note that if I remove the
"key int"
and"key array"
the test passesThe text was updated successfully, but these errors were encountered: