diff --git a/ChangeLog b/ChangeLog index 3253bba0..c240cbea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-05-31 Tatsuhiro Tsujikawa + + Added test case for XmlRpcProcessor to fail to parse malformed + document. + * test/XmlRpcRequestProcessorTest.cc + 2009-05-30 Tatsuhiro Tsujikawa Removed *.gmo files in po because they are generated on 'make diff --git a/test/XmlRpcRequestProcessorTest.cc b/test/XmlRpcRequestProcessorTest.cc index 47090ec3..792eacad 100644 --- a/test/XmlRpcRequestProcessorTest.cc +++ b/test/XmlRpcRequestProcessorTest.cc @@ -12,6 +12,7 @@ class XmlRpcRequestProcessorTest:public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(XmlRpcRequestProcessorTest); CPPUNIT_TEST(testParseMemory); + CPPUNIT_TEST(testParseMemory_shouldFail); CPPUNIT_TEST_SUITE_END(); public: void setUp() {} @@ -19,6 +20,7 @@ public: void tearDown() {} void testParseMemory(); + void testParseMemory_shouldFail(); }; @@ -72,6 +74,22 @@ void XmlRpcRequestProcessorTest::testParseMemory() CPPUNIT_ASSERT_EQUAL(std::string("hello world"), req._params[2][1].s()); } +void XmlRpcRequestProcessorTest::testParseMemory_shouldFail() +{ + XmlRpcRequestProcessor proc; + try { + proc.parseMemory("" + " aria2.addURI" + " " + " " + " 100" + " "); + CPPUNIT_FAIL("exception must be thrown."); + } catch(RecoverableException& e) { + // success + } +} + } // namespace xmlrpc } // namespace aria2