From 73a63ea05dc8ca29ec1d2c1d66481dd0de1950f1 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 24 Feb 2026 09:26:47 -0800 Subject: [PATCH] Improve str concatenation performance on MatchesTest Update str concatenation, instead of use operation+ use absl::StrCat whenever available. PiperOrigin-RevId: 874649732 Change-Id: I0acd91c04a9e50fa306e7130479bc330c1a0f068 --- googletest/src/gtest.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 3f8079137..8a3801807 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -885,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