You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/*Generates a nicely formatted matcher success / failure messageMuch like Message(...), but it attempts to pretty print diffs in stringsExpected <string>: "...aaaaabaaaaa..."to equal | <string>: "...aaaaazaaaaa..."*/funcMessageWithDiff(actual, message, expectedstring) string {
we get 5 characters of context around the first diff in a string comparison assertion error message.
5 characters is often enough, however when comparing large structs, as can be the case with protobuf messages example it would be useful to have more context. Otherwise, long values can obscure the key, and make it harder to back-out the issue.
Thanks for pointing that out, I hadn't considered it.
Still, I find the truncation super helpful on large structs. It has offered a nice balance of ease-of-test creation and usefulness of error messages.
from
format/format.go
:and https://github.com/onsi/gomega/blob/master/format/format.go#L146
we get 5 characters of context around the first diff in a string comparison assertion error message.
5 characters is often enough, however when comparing large structs, as can be the case with protobuf messages example it would be useful to have more context. Otherwise, long values can obscure the key, and make it harder to back-out the issue.
Suggestion: export
format.CharactersAroundMismatchToInclude
The text was updated successfully, but these errors were encountered: