diff options
Diffstat (limited to 'googletest/include/gtest')
-rw-r--r-- | googletest/include/gtest/gtest-printers.h | 8 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-port.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 2e33df4..98d0494 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -742,6 +742,14 @@ class UniversalPrinter<Optional<T>> { } }; +template <> +class UniversalPrinter<decltype(Nullopt())> { + public: + static void Print(decltype(Nullopt()), ::std::ostream* os) { + *os << "(nullopt)"; + } +}; + #endif // GTEST_INTERNAL_HAS_OPTIONAL #if GTEST_INTERNAL_HAS_VARIANT diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 0b42dde..790fdd8 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -2325,6 +2325,7 @@ namespace testing { namespace internal { template <typename T> using Optional = ::absl::optional<T>; +inline ::absl::nullopt_t Nullopt() { return ::absl::nullopt; } } // namespace internal } // namespace testing #else @@ -2338,6 +2339,7 @@ namespace testing { namespace internal { template <typename T> using Optional = ::std::optional<T>; +inline ::std::nullopt_t Nullopt() { return ::std::nullopt; } } // namespace internal } // namespace testing // The case where absl is configured NOT to alias std::optional is not |