[SERVER-18618] ComparisonAssertion in the unit testing framework should not require overloaded operator << Created: 21/May/15 Updated: 21/May/15 Resolved: 21/May/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Testing Infrastructure |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Adam Midvidy | Assignee: | Andy Schwerin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
This forces the usage of less expressive assertions on types that don't define such overloads. We could use SFINAE to dispatch to a specialization of ComparisonAssertion that prints the compared values if the types being compared are ostream printable, otherwise omit printing them. |
| Comments |
| Comment by Andy Schwerin [ 21/May/15 ] |
|
If ASSERT_EQ and its ilk cannot be used for a type because that type does not support the stream put operator, the correct developer action is to write: ASSERT(EXPR1 == EXPR2); Or, better yet, auto expected = EXPR1; |