rsam70
unread,Jun 24, 2012, 4:27:54 PM6/24/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google C++ Testing Framework
Hi,
i've a basic constructor test where a null pointer is being used. I
want to catch this behavior
TEST( List, CreateException )
{
EXPECT_DEATH( listInit( NULL ), "null pointer");
}
the following flags are used
::testing::FLAGS_gtest_catch_exceptions =true;
::testing::FLAGS_gtest_throw_on_failure=true;
the following output is produced by the exec.:
[ RUN ] List.Create
[ OK ] List.Create (0 ms)
[ RUN ] List.CreateException
D:\\unittests\TestC\Release>TeC.exe
Running all generic component tests
Note: Randomizing tests' orders with a seed of 40757 .
[==========] Running 15 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 6 tests from List
[ RUN ] List.GetHeadOneElement
[ OK ] List.GetHeadOneElement (0 ms)
[ RUN ] List.GetHeadEmptyList
[ OK ] List.GetHeadEmptyList (0 ms)
[ RUN ] List.Create
[ OK ] List.Create (0 ms)
[ RUN ] List.CreateException
Running all generic component tests
../src/listTest.cpp:173: Failure
Death test: listInit( __null )
Result: died but not with expected error.
Expected: null pointer
Actual msg:
[ DEATH ]
terminate called after throwing an instance of
'testing::GoogleTestFailureExcept
ion'
what(): ../src/listTest.cpp:173: Failure
Death test: listInit( __null )
Result: died but not with expected error.
Expected: null pointer
Actual msg:
[ DEATH ]
This application has requested the Runtime to terminate it in an
unusual way.
Please contact the application's support team for more information.
This test fails. How can i make this work.
listInit is c based calling context.
Thx.