diff options
author | Gennadiy Civil <misterg@google.com> | 2019-06-10 14:51:41 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2019-06-10 14:51:41 (GMT) |
commit | fbcb2eb2004dcc581e637b14e07cc4ed5820e9f5 (patch) | |
tree | d80a6430f477bcc25ddacadc9496979f5922466e /googlemock | |
parent | 6f79a3b8a7dce9e2fd883ef50c9f36161ff9e9d3 (diff) | |
download | googletest-fbcb2eb2004dcc581e637b14e07cc4ed5820e9f5.zip googletest-fbcb2eb2004dcc581e637b14e07cc4ed5820e9f5.tar.gz googletest-fbcb2eb2004dcc581e637b14e07cc4ed5820e9f5.tar.bz2 |
removing obsolete language from docs, CMake and Bazel is the only supporeted build methods
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/docs/FrequentlyAskedQuestions.md | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/googlemock/docs/FrequentlyAskedQuestions.md b/googlemock/docs/FrequentlyAskedQuestions.md index e91f038..412d844 100644 --- a/googlemock/docs/FrequentlyAskedQuestions.md +++ b/googlemock/docs/FrequentlyAskedQuestions.md @@ -251,77 +251,6 @@ They are unsafe to use and don't work with arguments that have constructors or destructors. Therefore we recommend to avoid them in C++ as much as possible. -## MSVC gives me warning C4301 or C4373 when I define a mock method with a const parameter. Why? ## - -If you compile this using Microsoft Visual C++ 2005 SP1: -```cpp -class Foo { - ... - virtual void Bar(const int i) = 0; -}; - -class MockFoo : public Foo { - ... - MOCK_METHOD1(Bar, void(const int i)); -}; -``` -You may get the following warning: -``` -warning C4301: 'MockFoo::Bar': overriding virtual function only differs from 'Foo::Bar' by const/volatile qualifier -``` - -This is a MSVC bug. The same code compiles fine with gcc ,for -example. If you use Visual C++ 2008 SP1, you would get the warning: -``` -warning C4373: 'MockFoo::Bar': virtual function overrides 'Foo::Bar', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers -``` - -In C++, if you _declare_ a function with a `const` parameter, the -`const` modifier is _ignored_. Therefore, the `Foo` base class above -is equivalent to: -```cpp -class Foo { - ... - virtual void Bar(int i) = 0; // int or const int? Makes no difference. -}; -``` - -In fact, you can _declare_ Bar() with an `int` parameter, and _define_ -it with a `const int` parameter. The compiler will still match them -up. - -Since making a parameter `const` is meaningless in the method -_declaration_, we recommend to remove it in both `Foo` and `MockFoo`. -That should workaround the VC bug. - -Note that we are talking about the _top-level_ `const` modifier here. -If the function parameter is passed by pointer or reference, declaring -the _pointee_ or _referee_ as `const` is still meaningful. For -example, the following two declarations are _not_ equivalent: -```cpp -void Bar(int* p); // Neither p nor *p is const. -void Bar(const int* p); // p is not const, but *p is. -``` - -## I have a huge mock class, and Microsoft Visual C++ runs out of memory when compiling it. What can I do? ## - -We've noticed that when the `/clr` compiler flag is used, Visual C++ -uses 5~6 times as much memory when compiling a mock class. We suggest -to avoid `/clr` when compiling native C++ mocks. - -## I can't figure out why Google Mock thinks my expectations are not satisfied. What should I do? ## - -You might want to run your test with -`--gmock_verbose=info`. This flag lets Google Mock print a trace -of every mock function call it receives. By studying the trace, -you'll gain insights on why the expectations you set are not met. - -## How can I assert that a function is NEVER called? ## - -```cpp -EXPECT_CALL(foo, Bar(_)) - .Times(0); -``` ## I have a failed test where Google Mock tells me TWICE that a particular expectation is not satisfied. Isn't this redundant? ## |