Avoids unnecessary printing of call into to internal buffers;

Made the universal value printer safer when printing char[];
Removed duplicated code in InvokeWith;
Improved gmock_doctor.py.
This commit is contained in:
zhanyong.wan
2009-05-29 19:50:06 +00:00
parent 16cf473930
commit 9413f2ff61
10 changed files with 390 additions and 275 deletions

View File

@@ -494,6 +494,34 @@ TEST(ExpectTest, FailsNonfatallyOnFalse) {
}, "Expectation failed");
}
// Tests LogIsVisible().
class LogIsVisibleTest : public ::testing::Test {
protected:
virtual void SetUp() { original_verbose_ = GMOCK_FLAG(verbose); }
virtual void TearDown() { GMOCK_FLAG(verbose) = original_verbose_; }
string original_verbose_;
};
TEST_F(LogIsVisibleTest, AlwaysReturnsTrueIfVerbosityIsInfo) {
GMOCK_FLAG(verbose) = kInfoVerbosity;
EXPECT_TRUE(LogIsVisible(INFO));
EXPECT_TRUE(LogIsVisible(WARNING));
}
TEST_F(LogIsVisibleTest, AlwaysReturnsFalseIfVerbosityIsError) {
GMOCK_FLAG(verbose) = kErrorVerbosity;
EXPECT_FALSE(LogIsVisible(INFO));
EXPECT_FALSE(LogIsVisible(WARNING));
}
TEST_F(LogIsVisibleTest, WorksWhenVerbosityIsWarning) {
GMOCK_FLAG(verbose) = kWarningVerbosity;
EXPECT_FALSE(LogIsVisible(INFO));
EXPECT_TRUE(LogIsVisible(WARNING));
}
// TODO(wan@google.com): find a way to re-enable these tests.
#if 0