diff options
Diffstat (limited to 'googletest/test/googletest-break-on-failure-unittest_.cc')
-rw-r--r-- | googletest/test/googletest-break-on-failure-unittest_.cc | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/googletest/test/googletest-break-on-failure-unittest_.cc b/googletest/test/googletest-break-on-failure-unittest_.cc index f84957a2d03b..337e34c33017 100644 --- a/googletest/test/googletest-break-on-failure-unittest_.cc +++ b/googletest/test/googletest-break-on-failure-unittest_.cc @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // Unit test for Google Test's break-on-failure mode. // // A user can ask Google Test to seg-fault when an assertion fails, using @@ -40,35 +39,33 @@ #include "gtest/gtest.h" -#if GTEST_OS_WINDOWS -# include <windows.h> -# include <stdlib.h> +#ifdef GTEST_OS_WINDOWS +#include <stdlib.h> +#include <windows.h> #endif namespace { // A test that's expected to fail. -TEST(Foo, Bar) { - EXPECT_EQ(2, 3); -} +TEST(Foo, Bar) { EXPECT_EQ(2, 3); } -#if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE +#if GTEST_HAS_SEH && !defined(GTEST_OS_WINDOWS_MOBILE) // On Windows Mobile global exception handlers are not supported. -LONG WINAPI ExitWithExceptionCode( - struct _EXCEPTION_POINTERS* exception_pointers) { +LONG WINAPI +ExitWithExceptionCode(struct _EXCEPTION_POINTERS* exception_pointers) { exit(exception_pointers->ExceptionRecord->ExceptionCode); } #endif } // namespace -int main(int argc, char **argv) { -#if GTEST_OS_WINDOWS +int main(int argc, char** argv) { +#ifdef GTEST_OS_WINDOWS // Suppresses display of the Windows error dialog upon encountering // a general protection fault (segment violation). SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS); -# if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE +#if GTEST_HAS_SEH && !defined(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 @@ -78,7 +75,7 @@ int main(int argc, char **argv) { // exceptions. SetUnhandledExceptionFilter(ExitWithExceptionCode); -# endif +#endif #endif // GTEST_OS_WINDOWS testing::InitGoogleTest(&argc, argv); |