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
show threshold in failure message of BeNumericallyMatcher #293
Conversation
d4a98ce
to
dcfe84c
Compare
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.
Thanks for this, I think it's really useful, just a few comments.
matchers/be_numerically_matcher.go
Outdated
if !positive { | ||
formatted = "not " + formatted | ||
} | ||
formatted = format.Message(actual, formatted, matcher.CompareTo[0]) |
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.
Can we just return here in place of setting the formatted
variable and then returning?
matchers/be_numerically_matcher.go
Outdated
} | ||
|
||
func (matcher *BeNumericallyMatcher) FormatFailureMessage(actual interface{}, positive bool) (message string) { | ||
var formatted string |
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.
Following on from the comment below, maybe we could just rename this to message
, since it's the thing that will be formatted, instead of the thing that is formatted.
matchers/be_numerically_matcher.go
Outdated
return matcher.FormatFailureMessage(actual, false) | ||
} | ||
|
||
func (matcher *BeNumericallyMatcher) FormatFailureMessage(actual interface{}, positive bool) (message string) { |
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.
Could we maybe change positive
here to negated
, and flip the boolean expressions to be consistent with the Method names. Also, can we make this private formatFailureMessage
?
dcfe84c
to
a850844
Compare
updated @williammartin |
LGTM thanks. |
solves onsi/ginkgo#503 (comment)
@williammartin