diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-04-27 02:22:14 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-04-27 02:22:14 +0000 |
| commit | 1ef99931e131343f069a4b74edfc06196d72d85b (patch) | |
| tree | d640f061a66a193d5f4d92b61836161208ccff14 /test/ParameterizedStringParserTest.cc | |
| parent | a7952cce05a41c6e20d6eddc569a8bffe974aade (diff) | |
2008-04-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten Exception class. Throw exception object, not its pointer and
catch by reference, so that remove problematic delete operator for
catched exception.
* src/Exception.cc
* src/Exception.h
* test/ExceptionTest.cc
* src/*: All files throwing/catching exception.
* test/*: All files throwing/catching exception.
Diffstat (limited to 'test/ParameterizedStringParserTest.cc')
| -rw-r--r-- | test/ParameterizedStringParserTest.cc | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/test/ParameterizedStringParserTest.cc b/test/ParameterizedStringParserTest.cc index 4d0cd79c..4b835ed6 100644 --- a/test/ParameterizedStringParserTest.cc +++ b/test/ParameterizedStringParserTest.cc @@ -70,9 +70,8 @@ void ParameterizedStringParserTest::testParse_select_empty() try { SharedHandle<PStringDatum> ls = ParameterizedStringParser().parse("{}"); CPPUNIT_FAIL("exception must be thrown."); - } catch(FatalException* e) { - std::cerr << e->getMsg() << std::endl; - delete e; + } catch(FatalException& e) { + std::cerr << e.stackTrace() << std::endl; } catch(...) { CPPUNIT_FAIL("unexpected exception thrown."); } @@ -83,9 +82,8 @@ void ParameterizedStringParserTest::testParse_select_missingParen() try { SharedHandle<PStringDatum> ls = ParameterizedStringParser().parse("{alpha"); CPPUNIT_FAIL("exception must be thrown."); - } catch(FatalException* e) { - std::cerr << e->getMsg() << std::endl; - delete e; + } catch(FatalException& e) { + std::cerr << e.stackTrace() << std::endl; } catch(...) { CPPUNIT_FAIL("unexpected exception was thrown."); } @@ -139,9 +137,8 @@ void ParameterizedStringParserTest::testParse_loop_empty() try { SharedHandle<PStringDatum> ls = ParameterizedStringParser().parse("[]"); CPPUNIT_FAIL("exception must be thrown."); - } catch(FatalException* e) { - std::cerr << e->getMsg() << std::endl; - delete e; + } catch(FatalException& e) { + std::cerr << e.stackTrace() << std::endl; } catch(...) { CPPUNIT_FAIL("unexpected exception was thrown."); } @@ -152,9 +149,8 @@ void ParameterizedStringParserTest::testParse_loop_missingParen() try { SharedHandle<PStringDatum> ls = ParameterizedStringParser().parse("["); CPPUNIT_FAIL("exception must be thrown."); - } catch(FatalException* e) { - std::cerr << e->getMsg() << std::endl; - delete e; + } catch(FatalException& e) { + std::cerr << e.stackTrace() << std::endl; } catch(...) { CPPUNIT_FAIL("unexpected exception was thrown."); } @@ -165,9 +161,8 @@ void ParameterizedStringParserTest::testParse_loop_missingStep() try { SharedHandle<PStringDatum> ls = ParameterizedStringParser().parse("[1-10:]"); CPPUNIT_FAIL("exception must be thrown."); - } catch(FatalException* e) { - std::cerr << e->getMsg() << std::endl; - delete e; + } catch(FatalException& e) { + std::cerr << e.stackTrace() << std::endl; } catch(...) { CPPUNIT_FAIL("unexpected exception was thrown."); } @@ -178,9 +173,8 @@ void ParameterizedStringParserTest::testParse_loop_missingRange() try { SharedHandle<PStringDatum> ls = ParameterizedStringParser().parse("[1-]"); CPPUNIT_FAIL("exception must be thrown."); - } catch(FatalException* e) { - std::cerr << e->getMsg() << std::endl; - delete e; + } catch(FatalException& e) { + std::cerr << e.stackTrace() << std::endl; } catch(...) { CPPUNIT_FAIL("unexpected exception was thrown."); } @@ -202,9 +196,8 @@ void ParameterizedStringParserTest::testParse_loop_mixedChar() try { ParameterizedStringParser().parse("[1-z:2]"); CPPUNIT_FAIL("exception must be thrown."); - } catch(FatalException* e) { - std::cerr << e->getMsg() << std::endl; - delete e; + } catch(FatalException& e) { + std::cerr << e.stackTrace() << std::endl; } catch(...) { CPPUNIT_FAIL("FatalException must be thrown."); } @@ -215,9 +208,8 @@ void ParameterizedStringParserTest::testParse_loop_mixedCase() try { ParameterizedStringParser().parse("[a-Z:2]"); CPPUNIT_FAIL("exception must be thrown."); - } catch(FatalException* e) { - std::cerr << e->getMsg() << std::endl; - delete e; + } catch(FatalException& e) { + std::cerr << e.stackTrace() << std::endl; } catch(...) { CPPUNIT_FAIL("FatalException must be thrown."); } |
