Makes IsContainerTest compatible with Sun C++ and Visual Age C++, based on Hady Zalek's report and experiment; also fixes a bug that causes it to think that a class named const_iterator is a container; also clarifies the Borland C++ compatibility fix in the comments based on Josh Kelley's suggestion.

This commit is contained in:
zhanyong.wan
2011-03-09 01:13:19 +00:00
parent 603533a0a4
commit 5451ffe816
3 changed files with 52 additions and 11 deletions

View File

@@ -936,6 +936,28 @@ TEST(PrintStlContainerTest, TwoDimensionalNativeArray) {
EXPECT_EQ("{ { 1, 2, 3 }, { 4, 5, 6 } }", Print(b));
}
// Tests that a class named iterator isn't treated as a container.
struct iterator {
char x;
};
TEST(PrintStlContainerTest, Iterator) {
iterator it = {};
EXPECT_EQ("1-byte object <00>", Print(it));
}
// Tests that a class named const_iterator isn't treated as a container.
struct const_iterator {
char x;
};
TEST(PrintStlContainerTest, ConstIterator) {
const_iterator it = {};
EXPECT_EQ("1-byte object <00>", Print(it));
}
#if GTEST_HAS_TR1_TUPLE
// Tests printing tuples.