Adds support for alternate path separator on Windows, and make all tests pass with CMake and VC++ 9 (by Manuel Klimek).

This commit is contained in:
zhanyong.wan
2010-02-02 22:33:34 +00:00
parent 81e1cc73c8
commit 8d37331056
6 changed files with 184 additions and 29 deletions

View File

@@ -43,6 +43,7 @@
#if GTEST_OS_WINDOWS
#include <windows.h>
#include <stdlib.h>
#endif
namespace {
@@ -52,6 +53,14 @@ TEST(Foo, Bar) {
EXPECT_EQ(2, 3);
}
#if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE
// On Windows Mobile global exception handlers are not supported.
LONG WINAPI ExitWithExceptionCode(
struct _EXCEPTION_POINTERS* exception_pointers) {
exit(exception_pointers->ExceptionRecord->ExceptionCode);
}
#endif
} // namespace
int main(int argc, char **argv) {
@@ -59,7 +68,18 @@ int main(int argc, char **argv) {
// Suppresses display of the Windows error dialog upon encountering
// a general protection fault (segment violation).
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
#if !GTEST_OS_WINDOWS_MOBILE
// The default unhandled exception filter does not always exit
// with the exception code as exit code - for example it exits with
// 0 for EXCEPTION_ACCESS_VIOLATION and 1 for EXCEPTION_BREAKPOINT
// if the application is compiled in debug mode. Thus we use our own
// filter which always exits with the exception code for unhandled
// exceptions.
SetUnhandledExceptionFilter(ExitWithExceptionCode);
#endif
#endif
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();