googletest
googletest copied to clipboard
Add mock_type to MockObjectState for dynamic type registration
This pull request adds support for tracking and displaying the dynamic type information of mock objects in Google Mock. The changes improve diagnostics by showing the type of the mock object when reporting errors, and provide a mechanism to register the type information for each mock object.
Enhancements to mock object diagnostics:
- Added a new member
mock_typeof typeconst std::type_info*to theMockObjectStatestruct to store the dynamic type of the mock object. - Updated error reporting in
MockObjectRegistryto display the type name of the mock object if type information is available.
API extension for type registration:
- Introduced a new template method
RegisterMockTypeinMockObjectRegistryto register the dynamic type information for a given mock object.
I would specify it implements FIXME in relating file.
// FIXME: Print the type of the leaked object.
// This can help the user identify the leaked object.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
I signed CLA
@derekmauro could you take a look?