diff options
author | shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925> | 2008-09-18 18:06:35 +0000 |
---|---|---|
committer | shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925> | 2008-09-18 18:06:35 +0000 |
commit | 7291f9d79146744508a910a510b64bb07354435f (patch) | |
tree | 44f4cc83029ced9b2281947e2aa9690fbdd6b15d | |
parent | 561492f80b2bfe2bf80b1f3903d3c5eb87e063b8 (diff) | |
download | googletest-7291f9d79146744508a910a510b64bb07354435f.tar.gz |
Makes Google Test compile (and all tests pass) on cygwin (possibly on wingw too).
git-svn-id: http://googletest.googlecode.com/svn/trunk@94 861a406c-534a-0410-8894-cb66d6ee9925
-rw-r--r-- | src/gtest.cc | 9 | ||||
-rwxr-xr-x | test/gtest_output_test.py | 20 |
2 files changed, 24 insertions, 5 deletions
diff --git a/src/gtest.cc b/src/gtest.cc index 8ca6ac8..8d2d2a2 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -1546,16 +1546,17 @@ bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs, #ifdef GTEST_OS_WINDOWS return _wcsicmp(lhs, rhs) == 0; -#elif defined(GTEST_OS_MAC) - // Mac OS X doesn't define wcscasecmp. +#elif defined(GTEST_OS_LINUX) + return wcscasecmp(lhs, rhs) == 0; +#else + // Mac OS X and Cygwin don't define wcscasecmp. Other unknown OSes + // may not define it either. wint_t left, right; do { left = towlower(*lhs++); right = towlower(*rhs++); } while (left && left == right); return left == right; -#else - return wcscasecmp(lhs, rhs) == 0; #endif // OS selector } diff --git a/test/gtest_output_test.py b/test/gtest_output_test.py index f91050c..68cfe5e 100755 --- a/test/gtest_output_test.py +++ b/test/gtest_output_test.py @@ -104,6 +104,20 @@ def RemoveTime(output): return re.sub(r'\(\d+ ms', '(? ms', output) +def RemoveTestCounts(output): + """Removes test counts from a Google Test program's output.""" + + output = re.sub(r'\d+ tests from \d+ test cases', + '? tests from ? test cases', output) + return re.sub(r'\d+ tests\.', '? tests.', output) + + +def RemoveDeathTests(output): + """Removes death test information from a Google Test program's output.""" + + return re.sub(r'\n.*DeathTest.*', '', output) + + def NormalizeOutput(output): """Normalizes output (the output of gtest_output_test_.exe).""" @@ -182,7 +196,11 @@ class GTestOutputTest(unittest.TestCase): golden = golden_file.read() golden_file.close() - self.assertEquals(golden, output) + # We want the test to pass regardless of death tests being + # supported or not. + self.assert_(output == golden or + RemoveTestCounts(output) == + RemoveTestCounts(RemoveDeathTests(golden))) if __name__ == '__main__': |