-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
assert: Add new assertion InEpsilonMapValues #1500
base: master
Are you sure you want to change the base?
Conversation
3494db0
to
94fc43e
Compare
@hendrywiranto, hi! I am not maintainer of (cc) @dolmen |
Yep I know, thanks for replying tho |
FYI, my focus is on fixing bugs, not on extending the API to have even more code to maintain. |
94fc43e
to
3e98b86
Compare
08cacbc
to
550dbac
Compare
} | ||
if expected == nil || actual == nil || | ||
reflect.TypeOf(actual).Kind() != reflect.Map || | ||
reflect.TypeOf(expected).Kind() != reflect.Map { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the check of the kind of actual.
Instead, just check the kind of expected and check that actual has the same type with call IsType(t, expected, actual, msgAndArgs...)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for review, kindly please check again
assert/assertions_test.go
Outdated
title string | ||
expected interface{} | ||
actual interface{} | ||
f func(TestingT, bool, ...interface{}) bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f func(TestingT, bool, ...interface{}) bool | |
f BoolAssertionFunc |
actual: nil, | ||
epsilon: 0.1, | ||
f: False, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests with map[string]string
and map[string]struct{}
.
550dbac
to
533650f
Compare
Summary
Add new assertion
InEpsilonMapValues
which is the same as InEpsilon, but it compares all values between two maps.Changes
InEpsilonMapValues
Motivation
Quoting #1497
Example
Related issues
Closes #1497