From df1aecf2a064c5360f2f4c37d1bf37641dcadbb6 Mon Sep 17 00:00:00 2001 From: ameliabarnabyhub Date: Fri, 14 Aug 2026 10:27:11 +0800 Subject: [PATCH] feat(printers): GTEST_MAX_NUM_ELEMENTS_TO_PRINT override (#4905) Signed-off-by: ameliabarnabyhub --- googletest/include/gtest/gtest-printers.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 315ce0a5..dec13736 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -163,6 +163,9 @@ struct IsStdSpan> { // the presence of const_iterator to avoid treating iterators as containers // because of iterator::iterator. Which means std::span satisfies the *intended* // condition of IsContainerTest. +#ifndef GTEST_MAX_NUM_ELEMENTS_TO_PRINT +#define GTEST_MAX_NUM_ELEMENTS_TO_PRINT 32 +#endif struct ContainerPrinter { template ::value) || IsStdSpan::value>::type> static void PrintValue(const T& container, std::ostream* os) { - const size_t kMaxCount = 32; // The maximum number of elements to print. + const size_t kMaxCount = + static_cast(GTEST_MAX_NUM_ELEMENTS_TO_PRINT); *os << '{'; size_t count = 0; for (auto&& elem : container) {