diff options
author | Steve M. Robbins <smr@sumost.ca> | 2007-01-12 04:49:43 +0000 |
---|---|---|
committer | Steve M. Robbins <smr@sumost.ca> | 2007-01-12 04:49:43 +0000 |
commit | b112c6d9ec9d7313d3befb6f20f55bacaa546149 (patch) | |
tree | 04fc6b49ea3010a50432ebd6986a4c23e1208191 /examples/cppunittest/TestAssertTest.cpp | |
parent | cc05d17f0e333f1873db4f4beb463ba9af18ee3e (diff) | |
download | cppunit-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.cpp | 12 |
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 { |