From a465636c8354ad6783b2b514fb0513a46720376e Mon Sep 17 00:00:00 2001 From: "kosak@google.com" Date: Mon, 17 Nov 2014 02:28:09 +0000 Subject: Strip trailing whitespace when stringifying type lists. git-svn-id: http://googletest.googlecode.com/svn/trunk@698 861a406c-534a-0410-8894-cb66d6ee9925 --- include/gtest/internal/gtest-internal.h | 2 +- include/gtest/internal/gtest-port.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h index 21a0f56..ba7175c 100644 --- a/include/gtest/internal/gtest-internal.h +++ b/include/gtest/internal/gtest-internal.h @@ -612,7 +612,7 @@ class TypeParameterizedTest { MakeAndRegisterTestInfo( (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/" + StreamableToString(index)).c_str(), - GetPrefixUntilComma(test_names).c_str(), + StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(), GetTypeName().c_str(), NULL, // No value parameter. GetTypeId(), diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index e7ddda5..9e0d6ef 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -2215,6 +2215,13 @@ inline char ToUpper(char ch) { return static_cast(toupper(static_cast(ch))); } +inline std::string StripTrailingSpaces(std::string str) { + std::string::iterator it = str.end(); + while (it != str.begin() && IsSpace(*--it)) + it = str.erase(it); + return str; +} + // The testing::internal::posix namespace holds wrappers for common // POSIX functions. These wrappers hide the differences between // Windows/MSVC and POSIX systems. Since some compilers define these -- cgit v1.2.1