From b112c6d9ec9d7313d3befb6f20f55bacaa546149 Mon Sep 17 00:00:00 2001 From: "Steve M. Robbins" Date: Fri, 12 Jan 2007 04:49:43 +0000 Subject: Put a C++ statement in the first argument of CPPUNIT_ASSERT_THROW() and CPPUNIT_ASSERT_NO_THROW(). --- examples/cppunittest/TestAssertTest.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'examples/cppunittest/TestAssertTest.cpp') 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 { -- cgit v1.2.1