diff options
author | tisi1988 <tisi1988@gmail.com> | 2018-07-23 08:10:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-23 08:10:26 (GMT) |
commit | 1ae4fdb79009322d90c304fd49d4fb625b408823 (patch) | |
tree | 6c343daa47b77dffb5b08cf64fe11f4b9fe1b63a /googletest/include/gtest | |
parent | de6e079f15b0d1988033fc8203d172f493d08506 (diff) | |
parent | 2a151c93c180ac765c27c5f2e37af9366abd4d55 (diff) | |
download | googletest-1ae4fdb79009322d90c304fd49d4fb625b408823.zip googletest-1ae4fdb79009322d90c304fd49d4fb625b408823.tar.gz googletest-1ae4fdb79009322d90c304fd49d4fb625b408823.tar.bz2 |
Merge branch 'master' into master
Diffstat (limited to 'googletest/include/gtest')
-rw-r--r-- | googletest/include/gtest/gtest-printers.h | 23 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-port.h | 6 |
2 files changed, 24 insertions, 5 deletions
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 373946b..66d54b9 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -114,6 +114,7 @@ #if GTEST_HAS_ABSL #include "absl/strings/string_view.h" #include "absl/types/optional.h" +#include "absl/types/variant.h" #endif // GTEST_HAS_ABSL namespace testing { @@ -787,6 +788,28 @@ class UniversalPrinter<::absl::optional<T>> { } }; +// Printer for absl::variant + +template <typename... T> +class UniversalPrinter<::absl::variant<T...>> { + public: + static void Print(const ::absl::variant<T...>& value, ::std::ostream* os) { + *os << '('; + absl::visit(Visitor{os}, value); + *os << ')'; + } + + private: + struct Visitor { + template <typename U> + void operator()(const U& u) const { + *os << "'" << GetTypeName<U>() << "' with value "; + UniversalPrint(u, os); + } + ::std::ostream* os; + }; +}; + #endif // GTEST_HAS_ABSL // UniversalPrintArray(begin, len, os) prints an array of 'len' diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index f07b69e..1afe934 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -522,11 +522,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #endif // !defined(GTEST_HAS_STD_STRING) #ifndef GTEST_HAS_GLOBAL_STRING -// The user didn't tell us whether ::string is available, so we need -// to figure it out. - # define GTEST_HAS_GLOBAL_STRING 0 - #endif // GTEST_HAS_GLOBAL_STRING #ifndef GTEST_HAS_STD_WSTRING @@ -1218,7 +1214,7 @@ class scoped_ptr { // Defines RE. #if GTEST_USES_PCRE -using ::RE; +// if used, PCRE is injected by custom/gtest-port.h #elif GTEST_USES_POSIX_RE || GTEST_USES_SIMPLE_RE // A simple C++ wrapper for <regex.h>. It uses the POSIX Extended |