aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtest-typed-test.cc
diff options
context:
space:
mode:
authorvladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2010-02-03 02:27:02 +0000
committervladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2010-02-03 02:27:02 +0000
commitcfcbc298cd91806e0e3417e03fce42bc4f1fa150 (patch)
treeaf456a0d47524f6bb5cbb49d160e0aaf60110daf /src/gtest-typed-test.cc
parent8d373310561a8d68d2a22ca7c6613deff5fa6e05 (diff)
downloadgoogletest-cfcbc298cd91806e0e3417e03fce42bc4f1fa150.tar.gz
googletest-cfcbc298cd91806e0e3417e03fce42bc4f1fa150.tar.bz2
googletest-cfcbc298cd91806e0e3417e03fce42bc4f1fa150.zip
Adds Solaris support (by Hady Zalek)
Diffstat (limited to 'src/gtest-typed-test.cc')
-rw-r--r--src/gtest-typed-test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gtest-typed-test.cc b/src/gtest-typed-test.cc
index 4a0f657d..3cc4b5de 100644
--- a/src/gtest-typed-test.cc
+++ b/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;