Merge pull request #4330 from IncludeGuardian:remove-iomanip
PiperOrigin-RevId: 554867591
Change-Id: Ib32da50384951532419cb54fb70f8ab0920178d7
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b5cf3c..089ac98 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,7 @@
cmake_minimum_required(VERSION 3.13)
project(googletest-distribution)
-set(GOOGLETEST_VERSION 1.13.0)
+set(GOOGLETEST_VERSION 1.14.0)
if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
set(CMAKE_CXX_EXTENSIONS OFF)
diff --git a/README.md b/README.md
index 443e020..1bca4d1 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
We recommend
[updating to the latest commit in the `main` branch as often as possible](https://github.com/abseil/abseil-cpp/blob/master/FAQ.md#what-is-live-at-head-and-how-do-i-do-it).
We do publish occasional semantic versions, tagged with
-`v${major}.${minor}.${patch}` (e.g. `v1.13.0`).
+`v${major}.${minor}.${patch}` (e.g. `v1.14.0`).
#### Documentation Updates
@@ -17,12 +17,12 @@
https://google.github.io/googletest/. We recommend browsing the documentation on
GitHub Pages rather than directly in the repository.
-#### Release 1.13.0
+#### Release 1.14.0
-[Release 1.13.0](https://github.com/google/googletest/releases/tag/v1.13.0) is
+[Release 1.14.0](https://github.com/google/googletest/releases/tag/v1.14.0) is
now available.
-The 1.13.x branch requires at least C++14.
+The 1.14.x branch requires at least C++14.
#### Continuous Integration
diff --git a/WORKSPACE b/WORKSPACE
index 1c8ea24..f819ffe 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -6,22 +6,22 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
- name = "rules_python", # 2023-01-10T22:00:51Z
- sha256 = "5de54486a60ad8948dabe49605bb1c08053e04001a431ab3e96745b4d97a4419",
- strip_prefix = "rules_python-70cce26432187a60b4e950118791385e6fb3c26f",
- urls = ["https://github.com/bazelbuild/rules_python/archive/70cce26432187a60b4e950118791385e6fb3c26f.zip"],
+ name = "rules_python", # 2023-07-31T20:39:27Z
+ sha256 = "1250b59a33c591a1c4ba68c62e95fc88a84c334ec35a2e23f46cbc1b9a5a8b55",
+ strip_prefix = "rules_python-e355becc30275939d87116a4ec83dad4bb50d9e1",
+ urls = ["https://github.com/bazelbuild/rules_python/archive/e355becc30275939d87116a4ec83dad4bb50d9e1.zip"],
)
http_archive(
- name = "bazel_skylib", # 2022-11-16T18:29:32Z
- sha256 = "a22290c26d29d3ecca286466f7f295ac6cbe32c0a9da3a91176a90e0725e3649",
- strip_prefix = "bazel-skylib-5bfcb1a684550626ce138fe0fe8f5f702b3764c3",
- urls = ["https://github.com/bazelbuild/bazel-skylib/archive/5bfcb1a684550626ce138fe0fe8f5f702b3764c3.zip"],
+ name = "bazel_skylib", # 2023-05-31T19:24:07Z
+ sha256 = "08c0386f45821ce246bbbf77503c973246ed6ee5c3463e41efc197fa9bc3a7f4",
+ strip_prefix = "bazel-skylib-288731ef9f7f688932bd50e704a91a45ec185f9b",
+ urls = ["https://github.com/bazelbuild/bazel-skylib/archive/288731ef9f7f688932bd50e704a91a45ec185f9b.zip"],
)
http_archive(
- name = "platforms", # 2022-11-09T19:18:22Z
- sha256 = "b4a3b45dc4202e2b3e34e3bc49d2b5b37295fc23ea58d88fb9e01f3642ad9b55",
- strip_prefix = "platforms-3fbc687756043fb58a407c2ea8c944bc2fe1d922",
- urls = ["https://github.com/bazelbuild/platforms/archive/3fbc687756043fb58a407c2ea8c944bc2fe1d922.zip"],
+ name = "platforms", # 2023-07-28T19:44:27Z
+ sha256 = "40eb313613ff00a5c03eed20aba58890046f4d38dec7344f00bb9a8867853526",
+ strip_prefix = "platforms-4ad40ef271da8176d4fc0194d2089b8a76e19d7b",
+ urls = ["https://github.com/bazelbuild/platforms/archive/4ad40ef271da8176d4fc0194d2089b8a76e19d7b.zip"],
)
diff --git a/docs/gmock_cheat_sheet.md b/docs/gmock_cheat_sheet.md
index 2fb0403..ddafaaa 100644
--- a/docs/gmock_cheat_sheet.md
+++ b/docs/gmock_cheat_sheet.md
@@ -20,7 +20,7 @@
(note that `~Foo()` **must** be virtual) we can define its mock as
```cpp
-#include "gmock/gmock.h"
+#include <gmock/gmock.h>
class MockFoo : public Foo {
public:
diff --git a/docs/gmock_cook_book.md b/docs/gmock_cook_book.md
index f736b9f..da10918 100644
--- a/docs/gmock_cook_book.md
+++ b/docs/gmock_cook_book.md
@@ -2640,8 +2640,8 @@
.WillRepeatedly(IncrementCounter(0));
foo.DoThis(); // Returns 1.
foo.DoThis(); // Returns 2.
- foo.DoThat(); // Returns 1 - Blah() uses a different
- // counter than Bar()'s.
+ foo.DoThat(); // Returns 1 - DoThat() uses a different
+ // counter than DoThis()'s.
```
versus
@@ -3194,7 +3194,7 @@
flag. For example, given the test program:
```cpp
-#include "gmock/gmock.h"
+#include <gmock/gmock.h>
using ::testing::_;
using ::testing::HasSubstr;
diff --git a/docs/gmock_for_dummies.md b/docs/gmock_for_dummies.md
index b7264d3..43f907a 100644
--- a/docs/gmock_for_dummies.md
+++ b/docs/gmock_for_dummies.md
@@ -164,7 +164,7 @@
After the process, you should have something like:
```cpp
-#include "gmock/gmock.h" // Brings in gMock.
+#include <gmock/gmock.h> // Brings in gMock.
class MockTurtle : public Turtle {
public:
@@ -224,8 +224,8 @@
```cpp
#include "path/to/mock-turtle.h"
-#include "gmock/gmock.h"
-#include "gtest/gtest.h"
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
using ::testing::AtLeast; // #1
diff --git a/docs/primer.md b/docs/primer.md
index c3aee3c..f2a97a7 100644
--- a/docs/primer.md
+++ b/docs/primer.md
@@ -395,7 +395,7 @@
```c++
#include "this/package/foo.h"
-#include "gtest/gtest.h"
+#include <gtest/gtest.h>
namespace my {
namespace project {
diff --git a/docs/reference/assertions.md b/docs/reference/assertions.md
index 1cdff26..492ff5e 100644
--- a/docs/reference/assertions.md
+++ b/docs/reference/assertions.md
@@ -1,7 +1,7 @@
# Assertions Reference
This page lists the assertion macros provided by GoogleTest for verifying code
-behavior. To use them, include the header `gtest/gtest.h`.
+behavior. To use them, add `#include <gtest/gtest.h>`.
The majority of the macros listed below come as a pair with an `EXPECT_` variant
and an `ASSERT_` variant. Upon failure, `EXPECT_` macros generate nonfatal
@@ -88,7 +88,7 @@
10:
```cpp
-#include "gmock/gmock.h"
+#include <gmock/gmock.h>
using ::testing::AllOf;
using ::testing::Gt;
diff --git a/docs/reference/mocking.md b/docs/reference/mocking.md
index e414ffb..ab37ebf 100644
--- a/docs/reference/mocking.md
+++ b/docs/reference/mocking.md
@@ -1,8 +1,7 @@
# Mocking Reference
This page lists the facilities provided by GoogleTest for creating and working
-with mock objects. To use them, include the header
-`gmock/gmock.h`.
+with mock objects. To use them, add `#include <gmock/gmock.h>`.
## Macros {#macros}
diff --git a/docs/reference/testing.md b/docs/reference/testing.md
index 17225a6..ead66b3 100644
--- a/docs/reference/testing.md
+++ b/docs/reference/testing.md
@@ -3,7 +3,7 @@
<!--* toc_depth: 3 *-->
This page lists the facilities provided by GoogleTest for writing test programs.
-To use them, include the header `gtest/gtest.h`.
+To use them, add `#include <gtest/gtest.h>`.
## Macros
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index bd9ba73..f20258b 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -175,9 +175,15 @@
static T Get() {
Assert(false, __FILE__, __LINE__,
"Default action undefined for the function return type.");
- return internal::Invalid<T>();
+#if defined(__GNUC__) || defined(__clang__)
+ __builtin_unreachable();
+#elif defined(_MSC_VER)
+ __assume(0);
+#else
+ return Invalid<T>();
// The above statement will never be reached, but is required in
// order for this function to compile.
+#endif
}
};
diff --git a/googlemock/src/gmock_main.cc b/googlemock/src/gmock_main.cc
index fb37b53..6b55412 100644
--- a/googlemock/src/gmock_main.cc
+++ b/googlemock/src/gmock_main.cc
@@ -32,7 +32,8 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32)
+#if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32) || \
+ (defined(GTEST_OS_NRF52) && defined(ARDUINO))
#ifdef GTEST_OS_ESP8266
extern "C" {
#endif
diff --git a/googletest/README.md b/googletest/README.md
index 6bbd7f8..9331fce 100644
--- a/googletest/README.md
+++ b/googletest/README.md
@@ -25,7 +25,7 @@
with
```
-git clone https://github.com/google/googletest.git -b v1.13.0
+git clone https://github.com/google/googletest.git -b v1.14.0
cd googletest # Main directory of the cloned repository.
mkdir build # Create a directory to hold the build output.
cd build
@@ -145,7 +145,7 @@
### Multi-threaded Tests
GoogleTest is thread-safe where the pthread library is available. After
-`#include "gtest/gtest.h"`, you can check the
+`#include <gtest/gtest.h>`, you can check the
`GTEST_IS_THREADSAFE` macro to see whether this is the case (yes if the macro is
`#defined` to 1, no if it's undefined.).
diff --git a/googletest/include/gtest/gtest-message.h b/googletest/include/gtest/gtest-message.h
index 4d4b152..59b805e 100644
--- a/googletest/include/gtest/gtest-message.h
+++ b/googletest/include/gtest/gtest-message.h
@@ -56,6 +56,13 @@
#include "gtest/internal/gtest-port.h"
+#ifdef GTEST_HAS_ABSL
+#include <type_traits>
+
+#include "absl/strings/internal/has_absl_stringify.h"
+#include "absl/strings/str_cat.h"
+#endif // GTEST_HAS_ABSL
+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
@@ -111,8 +118,17 @@
*ss_ << str;
}
- // Streams a non-pointer value to this object.
- template <typename T>
+ // Streams a non-pointer value to this object. If building a version of
+ // GoogleTest with ABSL, this overload is only enabled if the value does not
+ // have an AbslStringify definition.
+ template <typename T
+#ifdef GTEST_HAS_ABSL
+ ,
+ typename std::enable_if<
+ !absl::strings_internal::HasAbslStringify<T>::value, // NOLINT
+ int>::type = 0
+#endif // GTEST_HAS_ABSL
+ >
inline Message& operator<<(const T& val) {
// Some libraries overload << for STL containers. These
// overloads are defined in the global namespace instead of ::std.
@@ -133,6 +149,22 @@
return *this;
}
+#ifdef GTEST_HAS_ABSL
+ // Streams a non-pointer value with an AbslStringify definition to this
+ // object.
+ template <typename T,
+ typename std::enable_if<
+ absl::strings_internal::HasAbslStringify<T>::value, // NOLINT
+ int>::type = 0>
+ inline Message& operator<<(const T& val) {
+ // ::operator<< is needed here for a similar reason as with the non-Abseil
+ // version above
+ using ::operator<<;
+ *ss_ << absl::StrCat(val);
+ return *this;
+ }
+#endif // GTEST_HAS_ABSL
+
// Streams a pointer value to this object.
//
// This function is an overload of the previous one. When you
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h
index 1ba5178..d1766e6 100644
--- a/googletest/include/gtest/gtest-printers.h
+++ b/googletest/include/gtest/gtest-printers.h
@@ -43,6 +43,9 @@
// 1. foo::PrintTo(const T&, ostream*)
// 2. operator<<(ostream&, const T&) defined in either foo or the
// global namespace.
+// * Prefer AbslStringify(..) to operator<<(..), per https://abseil.io/tips/215.
+// * Define foo::PrintTo(..) if the type already has AbslStringify(..), but an
+// alternative presentation in test results is of interest.
//
// However if T is an STL-style container then it is printed element-wise
// unless foo::PrintTo(const T&, ostream*) is defined. Note that
@@ -112,6 +115,10 @@
#include <utility>
#include <vector>
+#ifdef GTEST_HAS_ABSL
+#include "absl/strings/internal/has_absl_stringify.h"
+#include "absl/strings/str_cat.h"
+#endif // GTEST_HAS_ABSL
#include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-port.h"
@@ -260,6 +267,18 @@
#endif
};
+#ifdef GTEST_HAS_ABSL
+struct ConvertibleToAbslStringifyPrinter {
+ template <
+ typename T,
+ typename = typename std::enable_if<
+ absl::strings_internal::HasAbslStringify<T>::value>::type> // NOLINT
+ static void PrintValue(const T& value, ::std::ostream* os) {
+ *os << absl::StrCat(value);
+ }
+};
+#endif // GTEST_HAS_ABSL
+
// Prints the given number of bytes in the given object to the given
// ostream.
GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes,
@@ -308,6 +327,9 @@
using Printer = typename FindFirstPrinter<
T, void, ContainerPrinter, FunctionPointerPrinter, PointerPrinter,
ProtobufPrinter,
+#ifdef GTEST_HAS_ABSL
+ ConvertibleToAbslStringifyPrinter,
+#endif // GTEST_HAS_ABSL
internal_stream_operator_without_lexical_name_lookup::StreamPrinter,
ConvertibleToIntegerPrinter, ConvertibleToStringViewPrinter,
RawBytesPrinter, FallbackPrinter>::type;
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 894f1e0..a932e68 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -2100,8 +2100,8 @@
// Assuming that each thread maintains its own stack of traces.
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
// assertions in its own thread.
-#define SCOPED_TRACE(message) \
- ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)( \
+#define SCOPED_TRACE(message) \
+ const ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)( \
__FILE__, __LINE__, (message))
// Compile-time assertion for type equality.
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index e5cfa44..97a9833 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -1496,19 +1496,20 @@
gtest_ar_, text, #actual, #expected) \
.c_str())
-#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::AlwaysTrue()) { \
- ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
- GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
- if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
- } \
- } else \
- GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__) \
- : fail("Expected: " #statement \
- " doesn't generate new fatal " \
- "failures in the current thread.\n" \
+#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (::testing::internal::AlwaysTrue()) { \
+ const ::testing::internal::HasNewFatalFailureHelper \
+ gtest_fatal_failure_checker; \
+ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
+ if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
+ goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
+ } \
+ } else /* NOLINT */ \
+ GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__) \
+ : fail("Expected: " #statement \
+ " doesn't generate new fatal " \
+ "failures in the current thread.\n" \
" Actual: it does.")
// Expands to the name of the class that implements the given test.
diff --git a/googletest/include/gtest/internal/gtest-port-arch.h b/googletest/include/gtest/internal/gtest-port-arch.h
index 3496493..3162f2b 100644
--- a/googletest/include/gtest/internal/gtest-port-arch.h
+++ b/googletest/include/gtest/internal/gtest-port-arch.h
@@ -115,6 +115,8 @@
#define GTEST_OS_QURT 1
#elif defined(CPU_QN9090) || defined(CPU_QN9090HN)
#define GTEST_OS_NXP_QN9090 1
+#elif defined(NRF52)
+#define GTEST_OS_NRF52 1
#endif // __CYGWIN__
#endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index 26e4cc3..b887e24 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -220,7 +220,6 @@
// GTEST_HAS_ALT_PATH_SEP_ - Always defined to 0 or 1.
// GTEST_WIDE_STRING_USES_UTF16_ - Always defined to 0 or 1.
// GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Always defined to 0 or 1.
-// GTEST_HAS_DOWNCAST_ - Always defined to 0 or 1.
// GTEST_HAS_NOTIFICATION_- Always defined to 0 or 1.
//
// Synchronization:
@@ -313,10 +312,6 @@
#include "gtest/internal/custom/gtest-port.h"
#include "gtest/internal/gtest-port-arch.h"
-#ifndef GTEST_HAS_DOWNCAST_
-#define GTEST_HAS_DOWNCAST_ 0
-#endif
-
#ifndef GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
#define GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ 0
#endif
@@ -506,7 +501,7 @@
defined(GTEST_OS_SOLARIS) || defined(GTEST_OS_HAIKU) || \
defined(GTEST_OS_ESP32) || defined(GTEST_OS_ESP8266) || \
defined(GTEST_OS_XTENSA) || defined(GTEST_OS_QURT) || \
- defined(GTEST_OS_NXP_QN9090)))
+ defined(GTEST_OS_NXP_QN9090) || defined(GTEST_OS_NRF52)))
#define GTEST_HAS_STD_WSTRING 1
#else
#define GTEST_HAS_STD_WSTRING 0
@@ -1146,47 +1141,6 @@
return x;
}
-// When you upcast (that is, cast a pointer from type Foo to type
-// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts
-// always succeed. When you downcast (that is, cast a pointer from
-// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because
-// how do you know the pointer is really of type SubclassOfFoo? It
-// could be a bare Foo, or of type DifferentSubclassOfFoo. Thus,
-// when you downcast, you should use this macro. In debug mode, we
-// use dynamic_cast<> to double-check the downcast is legal (we die
-// if it's not). In normal mode, we do the efficient static_cast<>
-// instead. Thus, it's important to test in debug mode to make sure
-// the cast is legal!
-// This is the only place in the code we should use dynamic_cast<>.
-// In particular, you SHOULDN'T be using dynamic_cast<> in order to
-// do RTTI (eg code like this:
-// if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo);
-// if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
-// You should design the code some other way not to need this.
-//
-// This relatively ugly name is intentional. It prevents clashes with
-// similar functions users may have (e.g., down_cast). The internal
-// namespace alone is not enough because the function can be found by ADL.
-template <typename To, typename From> // use like this: DownCast_<T*>(foo);
-inline To DownCast_(From* f) { // so we only accept pointers
- // Ensures that To is a sub-type of From *. This test is here only
- // for compile-time type checking, and has no overhead in an
- // optimized build at run-time, as it will be optimized away
- // completely.
- GTEST_INTENTIONAL_CONST_COND_PUSH_()
- if (false) {
- GTEST_INTENTIONAL_CONST_COND_POP_()
- const To to = nullptr;
- ::testing::internal::ImplicitCast_<From*>(to);
- }
-
-#if GTEST_HAS_RTTI
- // RTTI: debug mode only!
- GTEST_CHECK_(f == nullptr || dynamic_cast<To>(f) != nullptr);
-#endif
- return static_cast<To>(f);
-}
-
// Downcasts the pointer of type Base to Derived.
// Derived must be a subclass of Base. The parameter MUST
// point to a class of type Derived, not any subclass of it.
@@ -1194,17 +1148,12 @@
// check to enforce this.
template <class Derived, class Base>
Derived* CheckedDowncastToActualType(Base* base) {
+ static_assert(std::is_base_of<Base, Derived>::value,
+ "target type not derived from source type");
#if GTEST_HAS_RTTI
- GTEST_CHECK_(typeid(*base) == typeid(Derived));
+ GTEST_CHECK_(base == nullptr || dynamic_cast<Derived*>(base) != nullptr);
#endif
-
-#if GTEST_HAS_DOWNCAST_
- return ::down_cast<Derived*>(base);
-#elif GTEST_HAS_RTTI
- return dynamic_cast<Derived*>(base); // NOLINT
-#else
- return static_cast<Derived*>(base); // Poor man's downcast.
-#endif
+ return static_cast<Derived*>(base);
}
#if GTEST_HAS_STREAM_REDIRECTION
diff --git a/googletest/src/gtest-filepath.cc b/googletest/src/gtest-filepath.cc
index 1d30c95..513e947 100644
--- a/googletest/src/gtest-filepath.cc
+++ b/googletest/src/gtest-filepath.cc
@@ -102,7 +102,8 @@
#if defined(GTEST_OS_WINDOWS_MOBILE) || defined(GTEST_OS_WINDOWS_PHONE) || \
defined(GTEST_OS_WINDOWS_RT) || defined(GTEST_OS_ESP8266) || \
defined(GTEST_OS_ESP32) || defined(GTEST_OS_XTENSA) || \
- defined(GTEST_OS_QURT) || defined(GTEST_OS_NXP_QN9090)
+ defined(GTEST_OS_QURT) || defined(GTEST_OS_NXP_QN9090) || \
+ defined(GTEST_OS_NRF52)
// These platforms do not have a current directory, so we just return
// something reasonable.
return FilePath(kCurrentDirectoryString);
@@ -356,7 +357,8 @@
#elif defined(GTEST_OS_WINDOWS)
int result = _mkdir(pathname_.c_str());
#elif defined(GTEST_OS_ESP8266) || defined(GTEST_OS_XTENSA) || \
- defined(GTEST_OS_QURT) || defined(GTEST_OS_NXP_QN9090)
+ defined(GTEST_OS_QURT) || defined(GTEST_OS_NXP_QN9090) || \
+ defined(GTEST_OS_NRF52)
// do nothing
int result = 0;
#else
diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h
index 1e9b5c2..5b7fcbd 100644
--- a/googletest/src/gtest-internal-inl.h
+++ b/googletest/src/gtest-internal-inl.h
@@ -672,7 +672,7 @@
void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc,
internal::TearDownTestSuiteFunc tear_down_tc,
TestInfo* test_info) {
-#ifdef GTEST_HAS_FILE_SYSTEM
+#if GTEST_HAS_FILE_SYSTEM
// In order to support thread-safe death tests, we need to
// remember the original working directory when the test program
// was first invoked. We cannot do this in RUN_ALL_TESTS(), as
diff --git a/googletest/src/gtest_main.cc b/googletest/src/gtest_main.cc
index c2e3b3c..8141caf 100644
--- a/googletest/src/gtest_main.cc
+++ b/googletest/src/gtest_main.cc
@@ -31,7 +31,8 @@
#include "gtest/gtest.h"
-#if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32)
+#if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32) || \
+ (defined(GTEST_OS_NRF52) && defined(ARDUINO))
// Arduino-like platforms: program entry points are setup/loop instead of main.
#ifdef GTEST_OS_ESP8266
diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel
index 7754c13..1890b6f 100644
--- a/googletest/test/BUILD.bazel
+++ b/googletest/test/BUILD.bazel
@@ -64,6 +64,7 @@
"googletest-global-environment-unittest_.cc",
"googletest-break-on-failure-unittest_.cc",
"googletest-listener-test.cc",
+ "googletest-message-test.cc",
"googletest-output-test_.cc",
"googletest-list-tests-unittest_.cc",
"googletest-shuffle-test_.cc",
diff --git a/googletest/test/googletest-message-test.cc b/googletest/test/googletest-message-test.cc
index 54e9d43..bf1f094 100644
--- a/googletest/test/googletest-message-test.cc
+++ b/googletest/test/googletest-message-test.cc
@@ -36,10 +36,26 @@
#include "gtest/gtest-message.h"
#include "gtest/gtest.h"
+#ifdef GTEST_HAS_ABSL
+#include "absl/strings/str_format.h"
+#endif // GTEST_HAS_ABSL
+
namespace {
using ::testing::Message;
+#ifdef GTEST_HAS_ABSL
+struct AbslStringifiablePoint {
+ template <typename Sink>
+ friend void AbslStringify(Sink& sink, const AbslStringifiablePoint& p) {
+ absl::Format(&sink, "(%d, %d)", p.x, p.y);
+ }
+
+ int x;
+ int y;
+};
+#endif // GTEST_HAS_ABSL
+
// Tests the testing::Message class
// Tests the default constructor.
@@ -128,6 +144,13 @@
EXPECT_EQ("123", (Message() << 123).GetString());
}
+#ifdef GTEST_HAS_ABSL
+// Tests streaming a type with an AbslStringify definition.
+TEST(MessageTest, StreamsAbslStringify) {
+ EXPECT_EQ("(1, 2)", (Message() << AbslStringifiablePoint{1, 2}).GetString());
+}
+#endif // GTEST_HAS_ABSL
+
// Tests that basic IO manipulators (endl, ends, and flush) can be
// streamed to Message.
TEST(MessageTest, StreamsBasicIoManip) {
diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc
index f44f29a..bee0ca4 100644
--- a/googletest/test/googletest-printers-test.cc
+++ b/googletest/test/googletest-printers-test.cc
@@ -55,6 +55,10 @@
#include "gtest/gtest-printers.h"
#include "gtest/gtest.h"
+#ifdef GTEST_HAS_ABSL
+#include "absl/strings/str_format.h"
+#endif
+
// Some user-defined types for testing the universal value printer.
// An anonymous enum type.
@@ -119,6 +123,19 @@
os << "StreamableInGlobal*";
}
+#ifdef GTEST_HAS_ABSL
+// A user-defined type with AbslStringify
+struct Point {
+ template <typename Sink>
+ friend void AbslStringify(Sink& sink, const Point& p) {
+ absl::Format(&sink, "(%d, %d)", p.x, p.y);
+ }
+
+ int x = 10;
+ int y = 20;
+};
+#endif
+
namespace foo {
// A user-defined unprintable type in a user namespace.
@@ -317,6 +334,11 @@
EXPECT_EQ("invalid", Print(static_cast<EnumWithPrintTo>(0)));
}
+#ifdef GTEST_HAS_ABSL
+// Tests printing a class that defines AbslStringify
+TEST(PrintClassTest, AbslStringify) { EXPECT_EQ("(10, 20)", Print(Point())); }
+#endif
+
// Tests printing a class implicitly convertible to BiggestInt.
TEST(PrintClassTest, BiggestIntConvertible) {
@@ -1636,6 +1658,12 @@
EXPECT_STREQ("StreamableInGlobal", PrintToString(r).c_str());
}
+#ifdef GTEST_HAS_ABSL
+TEST(PrintToStringTest, AbslStringify) {
+ EXPECT_PRINT_TO_STRING_(Point(), "(10, 20)");
+}
+#endif
+
TEST(IsValidUTF8Test, IllFormedUTF8) {
// The following test strings are ill-formed UTF-8 and are printed
// as hex only (or ASCII, in case of ASCII bytes) because IsValidUTF8() is
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index 6caa03f..67d776e 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -4113,7 +4113,7 @@
EXPECT_THROW(throw 1, int);
EXPECT_NONFATAL_FAILURE(EXPECT_THROW(n++, int), "");
- EXPECT_NONFATAL_FAILURE(EXPECT_THROW(throw 1, const char*), "");
+ EXPECT_NONFATAL_FAILURE(EXPECT_THROW(throw n, const char*), "");
EXPECT_NO_THROW(n++);
EXPECT_NONFATAL_FAILURE(EXPECT_NO_THROW(throw 1), "");
EXPECT_ANY_THROW(throw 1);
diff --git a/googletest_deps.bzl b/googletest_deps.bzl
index 5e807d7..e25f5a1 100644
--- a/googletest_deps.bzl
+++ b/googletest_deps.bzl
@@ -7,16 +7,16 @@
if not native.existing_rule("com_googlesource_code_re2"):
http_archive(
- name = "com_googlesource_code_re2", # 2023-06-01
- sha256 = "1726508efc93a50854c92e3f7ac66eb28f0e57652e413f11d7c1e28f97d997ba",
- strip_prefix = "re2-03da4fc0857c285e3a26782f6bc8931c4c950df4",
- urls = ["https://github.com/google/re2/archive/03da4fc0857c285e3a26782f6bc8931c4c950df4.zip"],
+ name = "com_googlesource_code_re2", # 2023-03-17T11:36:51Z
+ sha256 = "cb8b5312a65f2598954545a76e8bce913f35fbb3a21a5c88797a4448e9f9b9d9",
+ strip_prefix = "re2-578843a516fd1da7084ae46209a75f3613b6065e",
+ urls = ["https://github.com/google/re2/archive/578843a516fd1da7084ae46209a75f3613b6065e.zip"],
)
if not native.existing_rule("com_google_absl"):
http_archive(
- name = "com_google_absl", # 2023-04-06T14:42:25Z
- sha256 = "a50452f02402262f9a61a8eedda60f76dda6b9538d36b34b55bce9f74a4d5ef8",
- strip_prefix = "abseil-cpp-e73b9139ee9b853a4bd7812531442c138da09084",
- urls = ["https://github.com/abseil/abseil-cpp/archive/e73b9139ee9b853a4bd7812531442c138da09084.zip"],
+ name = "com_google_absl", # 2023-08-01T14:59:13Z
+ sha256 = "d2c09bf3b3aba57ad87a56082020bee2948445407756e92ddaf3595396086853",
+ strip_prefix = "abseil-cpp-22091f4c0d6626b3ef40446ce3d4ccab19425ca3",
+ urls = ["https://github.com/abseil/abseil-cpp/archive/22091f4c0d6626b3ef40446ce3d4ccab19425ca3.zip"],
)