diff options
author | Steve M. Robbins <smr@sumost.ca> | 2008-02-21 02:48:05 +0000 |
---|---|---|
committer | Steve M. Robbins <smr@sumost.ca> | 2008-02-21 02:48:05 +0000 |
commit | e090e64a05c8aa899d48941a259124e7aaad6d63 (patch) | |
tree | 749670ec4fa2f41cebc4e72408a8a340bcbca4f1 | |
parent | a5a498561726d1396a681d1a8061156b90a56ec7 (diff) |
Replace deprecated CPPUNIT_TEST_EXCEPTION with code using CPPUNIT_ASSERT_THROW.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | examples/money/MoneyTest.cpp | 2 | ||||
-rw-r--r-- | examples/money/MoneyTest.h | 2 |
3 files changed, 7 insertions, 2 deletions
@@ -1,5 +1,10 @@ 2008-02-20 Steve M. Robbins <smr@sumost.ca> + * examples/money/MoneyTest.h (TestFixture): Change deprecated + CPPUNIT_TEST_EXCEPTION to simple CPPUNIT_TEST. + * examples/money/MoneyTest.cpp (testAddThrow): Wrap throwing + expression "money += money123FF" inside CPPUNIT_ASSERT_THROW(). + * Changes to build without warnings using gcc -Wall -W -ansi. Applied patch [1898225] to remove name of unused argument and use no-arg version of main(). Tested on both GCC 4.2.3 and a diff --git a/examples/money/MoneyTest.cpp b/examples/money/MoneyTest.cpp index 70e5986..65870a6 100644 --- a/examples/money/MoneyTest.cpp +++ b/examples/money/MoneyTest.cpp @@ -79,5 +79,5 @@ MoneyTest::testAddThrow() // Process Money money( 123, "USD" ); - money += money123FF; // should throw an exception + CPPUNIT_ASSERT_THROW( money += money123FF, IncompatibleMoneyError ); } diff --git a/examples/money/MoneyTest.h b/examples/money/MoneyTest.h index 44e1808..475f2e9 100644 --- a/examples/money/MoneyTest.h +++ b/examples/money/MoneyTest.h @@ -10,7 +10,7 @@ class MoneyTest : public CPPUNIT_NS::TestFixture CPPUNIT_TEST( testConstructor ); CPPUNIT_TEST( testEqual ); CPPUNIT_TEST( testAdd ); - CPPUNIT_TEST_EXCEPTION( testAddThrow, IncompatibleMoneyError ); + CPPUNIT_TEST( testAddThrow ); CPPUNIT_TEST_SUITE_END(); public: |