summaryrefslogtreecommitdiff
path: root/examples/cppunittest/TestAssertTest.cpp
diff options
context:
space:
mode:
authorSteve M. Robbins <smr@sumost.ca>2007-01-12 04:49:43 +0000
committerSteve M. Robbins <smr@sumost.ca>2007-01-12 04:49:43 +0000
commitb112c6d9ec9d7313d3befb6f20f55bacaa546149 (patch)
tree04fc6b49ea3010a50432ebd6986a4c23e1208191 /examples/cppunittest/TestAssertTest.cpp
parentcc05d17f0e333f1873db4f4beb463ba9af18ee3e (diff)
downloadcppunit-b112c6d9ec9d7313d3befb6f20f55bacaa546149.tar.gz
Put a C++ statement in the first argument of CPPUNIT_ASSERT_THROW()
and CPPUNIT_ASSERT_NO_THROW().
Diffstat (limited to 'examples/cppunittest/TestAssertTest.cpp')
-rw-r--r--examples/cppunittest/TestAssertTest.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/cppunittest/TestAssertTest.cpp b/examples/cppunittest/TestAssertTest.cpp
index 5c81a3f..6378e40 100644
--- a/examples/cppunittest/TestAssertTest.cpp
+++ b/examples/cppunittest/TestAssertTest.cpp
@@ -45,7 +45,8 @@ TestAssertTest::testAssertThrow()
try
{
- CPPUNIT_ASSERT_THROW( 1234, std::string );
+ int x;
+ CPPUNIT_ASSERT_THROW( x = 1234, std::string );
}
catch ( CPPUNIT_NS::Exception & )
{
@@ -59,7 +60,8 @@ TestAssertTest::testAssertThrow()
void
TestAssertTest::testAssertNoThrow()
{
- CPPUNIT_ASSERT_NO_THROW( 1234 );
+ int x;
+ CPPUNIT_ASSERT_NO_THROW( x = 1234 );
try
{
@@ -80,7 +82,8 @@ TestAssertTest::testAssertAssertionFail()
try
{
- CPPUNIT_ASSERT_ASSERTION_FAIL( 1234 );
+ int x;
+ CPPUNIT_ASSERT_ASSERTION_FAIL( x = 1234 );
}
catch ( CPPUNIT_NS::Exception & )
{
@@ -94,7 +97,8 @@ TestAssertTest::testAssertAssertionFail()
void
TestAssertTest::testAssertAssertionPass()
{
- CPPUNIT_ASSERT_ASSERTION_PASS( 1234 );
+ int x;
+ CPPUNIT_ASSERT_ASSERTION_PASS( x = 1234 );
try
{