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 /src | |
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 'src')
-rw-r--r-- | src/gmock-spec-builders.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gmock-spec-builders.cc b/src/gmock-spec-builders.cc index a74f9e57..2b48af13 100644 --- a/src/gmock-spec-builders.cc +++ b/src/gmock-spec-builders.cc @@ -245,9 +245,12 @@ GTEST_API_ ThreadLocal<Sequence*> g_gmock_implicit_sequence; // Reports an uninteresting call (whose description is in msg) in the // manner specified by 'reaction'. void ReportUninterestingCall(CallReaction reaction, const string& msg) { + // Include a stack trace only if --gmock_verbose=info is specified. + const int stack_frames_to_skip = + GMOCK_FLAG(verbose) == kInfoVerbosity ? 3 : -1; switch (reaction) { case kAllow: - Log(kInfo, msg, 3); + Log(kInfo, msg, stack_frames_to_skip); break; case kWarn: Log(kWarning, @@ -256,8 +259,8 @@ void ReportUninterestingCall(CallReaction reaction, const string& msg) { "call should not happen. Do not suppress it by blindly adding " "an EXPECT_CALL() if you don't mean to enforce the call. " "See http://code.google.com/p/googlemock/wiki/CookBook#" - "Knowing_When_to_Expect for details.", - 3); + "Knowing_When_to_Expect for details.\n", + stack_frames_to_skip); break; default: // FAIL Expect(false, NULL, -1, msg); |