Fixed comments

This commit is contained in:
Andrii Kucherenko 2023-02-03 17:53:13 +02:00
parent 31156e74f3
commit db0e9a6836
3 changed files with 8 additions and 10 deletions

View file

@ -189,10 +189,10 @@ expectations must be matched in a given order, you can use the
[`InSequence` clause](reference/mocking.md#EXPECT_CALL.InSequence) of
`EXPECT_CALL`, or use an [`InSequence` object](reference/mocking.md#InSequence).
## Distinguishing Between Unintresting Calls from Different Mocks
## Distinguishing between Unintresting Calls from Different Mocks
By default unintresting mock function calls will be logged as function name and its address.
In case when multiple instances of same mocked class is used it can be usefull to set mock name:
In case when multiple instances of same mocked class is used it can be useful to set mock name:
```cpp
Mock::SetMockName(&mock_obj, "NamedObject");
```

View file

@ -380,11 +380,11 @@ class GTEST_API_ Mock {
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Set name for mock. Will be used in output.
// Usefull when multiple instances of same mock is required.
static bool SetMockName(void* mock_obj, const std::string& mock_name)
// Useful when multiple instances of same mock is required.
static void SetMockName(void* mock_obj, const std::string& mock_name)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
// Returns mock name which was setted with SetMockName
// Returns mock name which was set using SetMockName
static std::string GetMockName(const void* mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);

View file

@ -634,16 +634,14 @@ bool Mock::VerifyAndClear(void* mock_obj)
}
// Set name for mock. Will be used in output.
// Usefull when multiple instances of same mock is required.
bool Mock::SetMockName(void* mock_obj, const std::string& mock_name)
// Useful when multiple instances of same mock is required.
void Mock::SetMockName(void* mock_obj, const std::string& mock_name)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
internal::MutexLock l(&internal::g_gmock_mutex);
g_mock_object_registry.states()[mock_obj].name = mock_name;
return true;
}
// Returns mock name which was setted with SetMockName
// Returns mock name which was set using SetMockName
std::string Mock::GetMockName(const void* mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
internal::MutexLock l(&internal::g_gmock_mutex);