Fixes tests leaking altered values of GMOCK_FLAG(verbose) (issue 110).

This commit is contained in:
vladlosev
2010-05-05 19:47:46 +00:00
parent 54af9ba50a
commit 76c1c612e2
3 changed files with 25 additions and 15 deletions

View File

@@ -565,10 +565,12 @@ void TestLogWithSeverity(const string& verbosity, LogSeverity severity,
// Tests that when the stack_frames_to_skip parameter is negative,
// Log() doesn't include the stack trace in the output.
TEST(LogTest, NoStackTraceWhenStackFramesToSkipIsNegative) {
const string saved_flag = GMOCK_FLAG(verbose);
GMOCK_FLAG(verbose) = kInfoVerbosity;
CaptureStdout();
Log(INFO, "Test log.\n", -1);
EXPECT_STREQ("\nTest log.\n", GetCapturedStdout().c_str());
GMOCK_FLAG(verbose) = saved_flag;
}
// Tests that in opt mode, a positive stack_frames_to_skip argument is