fix: compare functional option names for indirect calls #1626
+49
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Closes Functional Options testing broken for indirect calls #1380. The fix is consists of not comparing the the function names, as it is already asserted when comparing
expectedValues
andactualValues
Changes
Test_Mock_AssertExpectationsFunctionalOptionsTypeIndirectly
which would fail without the fixTest_Mock_AssertExpectationsFunctionalOptionsType_Diff
to examine behavior of slightly different functional options in expected vs actual.funcName
implementation to only compare the relevant last part, if applicable. This aids in reading the diff that is produced when the function names don't. match (for go1.20 or higher)Motivation
The choice was made to omit the comparison of function names completely, instead of comparing only the relevant last part. The reason is that go1.19 and lower don't give enough any meaningful comparable part in the function name. Nevertheless the most relevant part of the function name is included in the diff result. Without it, the diff yielded in
Test_Mock_AssertExpectationsFunctionalOptionsType_Diff
would have resulted in (go1.20):The current implementation instead yields a diff:
Though there could be added benefit in displaying the full location of the function, I can revert that part if desired.
Related issues
Closes #1380