aboutsummaryrefslogtreecommitdiffstats
path: root/gtest/src/gtest-typed-test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtest/src/gtest-typed-test.cc')
-rw-r--r--gtest/src/gtest-typed-test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/gtest/src/gtest-typed-test.cc b/gtest/src/gtest-typed-test.cc
index 4a0f657..3cc4b5d 100644
--- a/gtest/src/gtest-typed-test.cc
+++ b/gtest/src/gtest-typed-test.cc
@@ -37,6 +37,14 @@ namespace internal {
#if GTEST_HAS_TYPED_TEST_P
+// Skips to the first non-space char in str. Returns an empty string if str
+// contains only whitespace characters.
+static const char* SkipSpaces(const char* str) {
+ while (isspace(*str))
+ str++;
+ return str;
+}
+
// Verifies that registered_tests match the test names in
// defined_test_names_; returns registered_tests if successful, or
// aborts the program otherwise.
@@ -45,6 +53,10 @@ const char* TypedTestCasePState::VerifyRegisteredTestNames(
typedef ::std::set<const char*>::const_iterator DefinedTestIter;
registered_ = true;
+ // Skip initial whitespace in registered_tests since some
+ // preprocessors prefix stringizied literals with whitespace.
+ registered_tests = SkipSpaces(registered_tests);
+
Message errors;
::std::set<String> tests;
for (const char* names = registered_tests; names != NULL;