]> git-server-git.apps.pok.os.sepia.ceph.com Git - googletest.git/commitdiff
Makes Google Test compile (and all tests pass) on cygwin (possibly on wingw too).
authorshiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925>
Thu, 18 Sep 2008 18:06:35 +0000 (18:06 +0000)
committershiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925>
Thu, 18 Sep 2008 18:06:35 +0000 (18:06 +0000)
src/gtest.cc
test/gtest_output_test.py

index 8ca6ac8e1d2ea6786285545a0098d80e73a174c9..8d2d2a2a2e5ba3d421ee235118bcb99f1afe4854 100644 (file)
@@ -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
 }
 
index f91050c0ba12db3822e808bbd94f2b7ab5ad2c1b..68cfe5ec9dcde63e39d77ffb97b63c10472a4cde 100755 (executable)
@@ -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__':