googletest: uncaught exceptions thrown by a unit test should be reported as failing tests

What steps will reproduce the problem?
1. write a test that throws an exception
2. build and run the test on mac and other platforms (mingw/cygwin on windows)
3. exception crashes the test app so no other tests are run or reported

What is the expected output? 
  [ RUN      ] ExceptionsAsErrors.TestThrowsInt
../test/test_exceptions.cc:12: Failure. Exception of type 'int' 
thrown by test.
              (Ideally, print name of exception type, 
               the "what()" string if it is a 
               subclass of std::exception, and a stack crawl.)
  [   FAILED ]  ExceptionsAsErrors.TestThrowsInt

What do you see instead?
  [ RUN      ] ExceptionsAsErrors.TestThrowsInt
  terminate called after throwing an instance of 'int'
  make[1]: *** [run-tests] Abort trap
  make: *** [all] Error 2


Please use labels and text to provide additional information.

this is release 1.1 of gTest

Original issue reported on code.google.com by keith....@gmail.com on 3 Oct 2008 at 9:03

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 26 (25 by maintainers)

Commits related to this issue

Most upvoted comments

Are there any plans to add printing of std::exception#what()?  It is really 
annoying to just see "unexpected exception".

Original comment by kevincox@kevincox.ca on 2 Jun 2015 at 2:17