aboutsummaryrefslogtreecommitdiffstats
path: root/googletest/test/gtest-printers_test.cc
diff options
context:
space:
mode:
authorChe-Hsun Liu <chehsunliu@gmail.com>2017-08-31 19:02:12 +0800
committerGitHub <noreply@github.com>2017-08-31 19:02:12 +0800
commit3eaba9f07c5f81a8b83432e4ae389ee42337393f (patch)
tree948d6ccdcf5a59ec1310cf81817ea2042236bbb9 /googletest/test/gtest-printers_test.cc
parent24696c3958f0be6a87b52f07436417c53d0fef24 (diff)
parent16bfba08e2c63c33834a98d092cd6f1a3e547289 (diff)
downloadgoogletest-3eaba9f07c5f81a8b83432e4ae389ee42337393f.tar.gz
googletest-3eaba9f07c5f81a8b83432e4ae389ee42337393f.tar.bz2
googletest-3eaba9f07c5f81a8b83432e4ae389ee42337393f.zip
Merge branch 'master' into master
Diffstat (limited to 'googletest/test/gtest-printers_test.cc')
-rw-r--r--googletest/test/gtest-printers_test.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/gtest-printers_test.cc
index b0a83410..487d3cb3 100644
--- a/googletest/test/gtest-printers_test.cc
+++ b/googletest/test/gtest-printers_test.cc
@@ -187,6 +187,29 @@ inline ::std::ostream& operator<<(::std::ostream& os,
return os << "StreamableTemplateInFoo: " << x.value();
}
+// A user-defined streamable but recursivly-defined container type in
+// a user namespace, it mimics therefore std::filesystem::path or
+// boost::filesystem::path.
+class PathLike {
+ public:
+ struct iterator
+ {
+ typedef PathLike value_type;
+ };
+ typedef iterator const_iterator;
+
+ PathLike() {}
+
+ iterator begin() const { return iterator(); }
+ iterator end() const { return iterator(); }
+
+ friend
+ ::std::ostream& operator<<(::std::ostream& os, const PathLike&)
+ {
+ return os << "Streamable-PathLike";
+ }
+};
+
} // namespace foo
namespace testing {
@@ -1161,6 +1184,15 @@ TEST(PrintStreamableTypeTest, TemplateTypeInUserNamespace) {
Print(::foo::StreamableTemplateInFoo<int>()));
}
+// Tests printing a user-defined recursive container type that has a <<
+// operator.
+TEST(PrintStreamableTypeTest, PathLikeInUserNamespace) {
+ ::foo::PathLike x;
+ EXPECT_EQ("Streamable-PathLike", Print(x));
+ const ::foo::PathLike cx;
+ EXPECT_EQ("Streamable-PathLike", Print(cx));
+}
+
// Tests printing user-defined types that have a PrintTo() function.
TEST(PrintPrintableTypeTest, InUserNamespace) {
EXPECT_EQ("PrintableViaPrintTo: 0",