Repository: nodejs/node
Pull request: deps: update googletest to a35bc7693c117a048152beeb34f6aac354b9423f

This is an automated update of googletest to a35bc7693c117a048152beeb34f6aac354b9423f.

Changed files:
filename: deps/googletest/include/gtest/gtest-test-part.h
patch: @@ -37,6 +37,7 @@
 #include <iosfwd>
 #include <ostream>
 #include <string>
+#include <string_view>
 #include <vector>
 
 #include "gtest/internal/gtest-internal.h"
@@ -65,10 +66,10 @@ class GTEST_API_ [[nodiscard]] TestPartResult {
   // C'tor.  TestPartResult does NOT have a default constructor.
   // Always use this constructor (with parameters) to create a
   // TestPartResult object.
-  TestPartResult(Type a_type, const char* a_file_name, int a_line_number,
-                 const char* a_message)
+  TestPartResult(Type a_type, std::string_view a_file_name, int a_line_number,
+                 std::string_view a_message)
       : type_(a_type),
-        file_name_(a_file_name == nullptr ? "" : a_file_name),
+        file_name_(a_file_name),
         line_number_(a_line_number),
         summary_(ExtractSummary(a_message)),
         message_(a_message) {}
@@ -112,7 +113,7 @@ class GTEST_API_ [[nodiscard]] TestPartResult {
 
   // Gets the summary of the failure message by omitting the stack
   // trace in it.
-  static std::string ExtractSummary(const char* message);
+  static std::string ExtractSummary(std::string_view message);
 
   // The name of the source file where the test part took place, or
   // "" if the source file is unknown.

filename: deps/googletest/include/gtest/gtest.h
patch: @@ -57,6 +57,7 @@
 #include <set>
 #include <sstream>
 #include <string>
+#include <string_view>
 #include <type_traits>
 #include <vector>
 
@@ -1246,7 +1247,7 @@ class GTEST_API_ [[nodiscard]] UnitTest {
   // eventually call this to report their results.  The user code
   // should use the assertion macros instead of calling this directly.
   void AddTestPartResult(TestPartResult::Type result_type,
-                         const char* file_name, int line_number,
+                         std::string_view file_name, int line_number,
                          const std::string& message,
                          const std::string& os_stack_trace)
       GTEST_LOCK_EXCLUDED_(mutex_);
@@ -1619,6 +1620,8 @@ class GTEST_API_ [[nodiscard]] AssertHelper {
   // Constructor.
   AssertHelper(TestPartResult::Type type, const char* file, int line,
                const char* message);
+  AssertHelper(TestPartResult::Type type, std::string_view file, int line,
+               std::string_view message);
   ~AssertHelper();
 
   // Message assignment is a semantic trick to enable assertion
@@ -1632,12 +1635,12 @@ class GTEST_API_ [[nodiscard]] AssertHelper {
   // re-using stack space even for temporary variables, so every EXPECT_EQ
   // reserves stack space for another AssertHelper.
   struct AssertHelperData {
-    AssertHelperData(TestPartResult::Type t, const char* srcfile, int line_num,
-                     const char* msg)
+    AssertHelperData(TestPartResult::Type t, std::string_view srcfile,
+                     int line_num, std::string_view msg)
         : type(t), file(srcfile), line(line_num), message(msg) {}
 
     TestPartResult::Type const type;
-    const char* const file;
+    const std::string_view file;
     int const line;
     std::string const message;
 

filename: deps/googletest/include/gtest/internal/gtest-internal.h
patch: @@ -1452,8 +1452,7 @@ class [[nodiscard]] NeverThrown {
     ;                                                                 \
   else                                                                \
     fail(::testing::internal::GetBoolAssertionFailureMessage(         \
-             gtest_ar_, text, #actual, #expected)                     \
-             .c_str())
+        gtest_ar_, text, #actual, #expected))
 
 #define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail)               \
   GTEST_AMBIGUOUS_ELSE_BLOCKER_                                     \

filename: deps/googletest/src/gtest-test-part.cc
patch: @@ -34,17 +34,19 @@
 
 #include <ostream>
 #include <string>
+#include <string_view>
 
+#include "gtest/internal/gtest-internal.h"
 #include "gtest/internal/gtest-port.h"
 #include "src/gtest-internal-inl.h"
 
 namespace testing {
 
 // Gets the summary of the failure message by omitting the stack trace
 // in it.
-std::string TestPartResult::ExtractSummary(const char* message) {
-  const char* const stack_trace = strstr(message, internal::kStackTraceMarker);
-  return stack_trace == nullptr ? message : std::string(message, stack_trace);
+std::string TestPartResult::ExtractSummary(const std::string_view message) {
+  auto stack_trace = message.find(internal::kStackTraceMarker);
+  return std::string(message.substr(0, stack_trace));
 }
 
 // Prints a TestPartResult object.

filename: deps/googletest/src/gtest.cc
patch: @@ -58,6 +58,7 @@
 #include <ostream>  // NOLINT
 #include <set>
 #include <sstream>
+#include <string_view>
 #include <unordered_set>
 #include <utility>
 #include <vector>
@@ -485,6 +486,15 @@ bool ShouldEmitStackTraceForResultType(TestPartResult::Type type) {
 // AssertHelper constructor.
 AssertHelper::AssertHelper(TestPartResult::Type type, const char* file,
                            int line, const char* message)
+    : AssertHelper(
+          type, file == nullptr ? std::string_view() : std::string_view(file),
+          line,
+          message == nullptr ? std::string_view() : std::string_view(message)) {
+}
+
+AssertHelper::AssertHelper(TestPartResult::Type type,
+                           const std::string_view file, int line,
+                           const std::string_view message)
     : data_(new AssertHelperData(type, file, line, message)) {}
 
 AssertHelper::~AssertHelper() { delete data_; }
@@ -875,7 +885,11 @@ class PositiveAndNegativeUnitTestFilter {
   // and does not match the negative filter.
   bool MatchesTest(const std::string& test_suite_name,
                    const std::string& test_name) const {
+#ifdef GTEST_HAS_ABSL
+    return MatchesName(absl::StrCat(test_suite_name, ".", test_name));
+#else
     return MatchesName(test_suite_name + "." + test_name);
+#endif
   }
 
   // Returns true if and only if name matches the positive filter and does not
@@ -2547,8 +2561,9 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
   // AddTestPartResult.
   UnitTest::GetInstance()->AddTestPartResult(
       result_type,
-      nullptr,  // No info about the source file where the exception occurred.
-      -1,       // We have no info on which line caused the exception.
+      std::string_view(),  // No info about the source file where the exception
+                           // occurred.
+      -1,  // We have no info on which line caused the exception.
       message,
       "");  // No stack trace, either.
 }
@@ -5428,8 +5443,8 @@ Environment* UnitTest::AddEnvironment(Environment* env) {
 // this to report their results.  The user code should use the
 // assertion macros instead of calling this directly.
 void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
-                                 const char* file_name, int line_number,
-                                 const std::string& message,
+                                 const std::string_view file_name,
+                                 int line_number, const std::string& message,
                                  const std::string& os_stack_trace)
     GTEST_LOCK_EXCLUDED_(mutex_) {
   Message msg;