pranavkantgaur / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Simple test crash on vs2010 (gtest 1.6) #420

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
IMPORTANT NOTE: PLEASE send issues or requests to
http://groups.google.com/group/googletestframework *instead of here*.
This issue tracker is NOT regularly monitored.

If you really need to create a new issue, please provide the information
asked for below.

What steps will reproduce the problem?
Main file is as follows:
int main(int argc, char **argv) 
{
    ::testing::InitGoogleMock(&argc, argv);
    ::testing::GTEST_FLAG(throw_on_failure) = true;
    ::testing::GTEST_FLAG(catch_exceptions) = true;
    auto result = RUN_ALL_TESTS();
   return result;
}

Test file is as follows:
TEST(testy, test_bad)
{
    ASSERT_TRUE(false);
}

TEST(testy, test_good)
{
}

What is the expected output? What do you see instead?
On VS2010 the test will fail but it will throw an exception and crash the 
program, it will not reach "test_good".
A little snooping around shows that:
// This exception doesn't originate in code under test. It makes no
// sense to report it as a test failure.

This is a problem as I want to generate some sort of output to use for a build 
system.

What version of Google Test are you using? On what operating system?
This is on windows 7 with Gtest 1.6

Original issue reported on code.google.com by j...@rayv.com on 23 Sep 2012 at 4:20

GoogleCodeExporter commented 9 years ago
The throw_on_failure is designed to be used with other test framework, not 
Google Test itself. Exceptions generated by it will escape RUN_ALL_TESTS.

Original comment by vladlosev on 24 Sep 2012 at 5:45