Fixed comments
This commit is contained in:
parent
31156e74f3
commit
db0e9a6836
@ -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
|
[`InSequence` clause](reference/mocking.md#EXPECT_CALL.InSequence) of
|
||||||
`EXPECT_CALL`, or use an [`InSequence` object](reference/mocking.md#InSequence).
|
`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.
|
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
|
```cpp
|
||||||
Mock::SetMockName(&mock_obj, "NamedObject");
|
Mock::SetMockName(&mock_obj, "NamedObject");
|
||||||
```
|
```
|
||||||
|
@ -380,11 +380,11 @@ class GTEST_API_ Mock {
|
|||||||
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
||||||
|
|
||||||
// Set name for mock. Will be used in output.
|
// Set name for mock. Will be used in output.
|
||||||
// Usefull when multiple instances of same mock is required.
|
// Useful when multiple instances of same mock is required.
|
||||||
static bool SetMockName(void* mock_obj, const std::string& mock_name)
|
static void SetMockName(void* mock_obj, const std::string& mock_name)
|
||||||
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
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)
|
static std::string GetMockName(const void* mock_obj)
|
||||||
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
|
||||||
|
|
||||||
|
@ -634,16 +634,14 @@ bool Mock::VerifyAndClear(void* mock_obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set name for mock. Will be used in output.
|
// Set name for mock. Will be used in output.
|
||||||
// Usefull when multiple instances of same mock is required.
|
// Useful when multiple instances of same mock is required.
|
||||||
bool Mock::SetMockName(void* mock_obj, const std::string& mock_name)
|
void Mock::SetMockName(void* mock_obj, const std::string& mock_name)
|
||||||
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
|
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
|
||||||
internal::MutexLock l(&internal::g_gmock_mutex);
|
internal::MutexLock l(&internal::g_gmock_mutex);
|
||||||
|
|
||||||
g_mock_object_registry.states()[mock_obj].name = mock_name;
|
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)
|
std::string Mock::GetMockName(const void* mock_obj)
|
||||||
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
|
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) {
|
||||||
internal::MutexLock l(&internal::g_gmock_mutex);
|
internal::MutexLock l(&internal::g_gmock_mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user