diff options
author | kosak <kosak@google.com> | 2015-02-14 22:05:58 +0000 |
---|---|---|
committer | kosak <kosak@google.com> | 2015-02-14 22:05:58 +0000 |
commit | 5625dd333a621932c469e2261fd9f0c8687378f8 (patch) | |
tree | 59c80ebfe8e93ff55f33bb89682a1dff557d076c /test/gmock-spec-builders_test.cc | |
parent | d478a1f46d51ac2baa3f3b3896139897f24dc2d1 (diff) | |
download | googletest-5625dd333a621932c469e2261fd9f0c8687378f8.tar.gz googletest-5625dd333a621932c469e2261fd9f0c8687378f8.tar.bz2 googletest-5625dd333a621932c469e2261fd9f0c8687378f8.zip |
Suppresses the stack trace in a warning for uninteresting call by default; the stack trace will still be printed when --gmock_verbose=info is printed.
Diffstat (limited to 'test/gmock-spec-builders_test.cc')
-rw-r--r-- | test/gmock-spec-builders_test.cc | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/test/gmock-spec-builders_test.cc b/test/gmock-spec-builders_test.cc index b8f7a11d..342c22f5 100644 --- a/test/gmock-spec-builders_test.cc +++ b/test/gmock-spec-builders_test.cc @@ -81,6 +81,7 @@ using testing::Gt; using testing::InSequence; using testing::Invoke; using testing::InvokeWithoutArgs; +using testing::IsNotSubstring; using testing::IsSubstring; using testing::Lt; using testing::Message; @@ -1977,9 +1978,25 @@ class VerboseFlagPreservingFixture : public testing::Test { #if GTEST_HAS_STREAM_REDIRECTION // Tests that an uninteresting mock function call on a naggy mock -// generates a warning containing the stack trace. +// generates a warning without the stack trace when +// --gmock_verbose=warning is specified. TEST(FunctionCallMessageTest, - UninterestingCallOnNaggyMockGeneratesFyiWithStackTrace) { + UninterestingCallOnNaggyMockGeneratesNoStackTraceWhenVerboseWarning) { + GMOCK_FLAG(verbose) = kWarningVerbosity; + NaggyMock<MockC> c; + CaptureStdout(); + c.VoidMethod(false, 5, "Hi", NULL, Printable(), Unprintable()); + const std::string output = GetCapturedStdout(); + EXPECT_PRED_FORMAT2(IsSubstring, "GMOCK WARNING", output); + EXPECT_PRED_FORMAT2(IsNotSubstring, "Stack trace:", output); +} + +// Tests that an uninteresting mock function call on a naggy mock +// generates a warning containing the stack trace when +// --gmock_verbose=info is specified. +TEST(FunctionCallMessageTest, + UninterestingCallOnNaggyMockGeneratesFyiWithStackTraceWhenVerboseInfo) { + GMOCK_FLAG(verbose) = kInfoVerbosity; NaggyMock<MockC> c; CaptureStdout(); c.VoidMethod(false, 5, "Hi", NULL, Printable(), Unprintable()); @@ -2112,8 +2129,7 @@ class GMockVerboseFlagTest : public VerboseFlagPreservingFixture { "\nGMOCK WARNING:\n" "Uninteresting mock function call - returning directly.\n" " Function call: DoA(5)\n" + - note + - "\nStack trace:\n", + note, "DoA"); // A non-void-returning function. @@ -2126,8 +2142,7 @@ class GMockVerboseFlagTest : public VerboseFlagPreservingFixture { "Uninteresting mock function call - returning default value.\n" " Function call: Binary(2, 1)\n" " Returns: false\n" + - note + - "\nStack trace:\n", + note, "Binary"); } }; |