|
@@ -14,6 +14,7 @@ class XmlRpcRequestProcessorTest:public CppUnit::TestFixture {
|
|
|
CPPUNIT_TEST_SUITE(XmlRpcRequestProcessorTest);
|
|
|
CPPUNIT_TEST(testParseMemory);
|
|
|
CPPUNIT_TEST(testParseMemory_shouldFail);
|
|
|
+ CPPUNIT_TEST(testParseMemory_withoutStringTag);
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
public:
|
|
|
void setUp() {}
|
|
@@ -22,6 +23,7 @@ public:
|
|
|
|
|
|
void testParseMemory();
|
|
|
void testParseMemory_shouldFail();
|
|
|
+ void testParseMemory_withoutStringTag();
|
|
|
};
|
|
|
|
|
|
|
|
@@ -114,6 +116,58 @@ void XmlRpcRequestProcessorTest::testParseMemory_shouldFail()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void XmlRpcRequestProcessorTest::testParseMemory_withoutStringTag()
|
|
|
+{
|
|
|
+ XmlRpcRequestProcessor proc;
|
|
|
+ RpcRequest req =
|
|
|
+ proc.parseMemory("<?xml version=\"1.0\"?>"
|
|
|
+ "<methodCall>"
|
|
|
+ " <methodName>aria2.addUri</methodName>"
|
|
|
+ " <params>"
|
|
|
+ " <param>"
|
|
|
+ " <value>http://aria2.sourceforge.net</value>"
|
|
|
+ " </param>"
|
|
|
+ " <param>"
|
|
|
+ " <value>http://aria2.<foo/>sourceforge.net</value>"
|
|
|
+ " </param>"
|
|
|
+ " <param>"
|
|
|
+ " <value>"
|
|
|
+ " <struct>"
|
|
|
+ " <member>"
|
|
|
+ " <name>hello</name>"
|
|
|
+ " <value>world</value>"
|
|
|
+ " </member>"
|
|
|
+ " </struct>"
|
|
|
+ " </value>"
|
|
|
+ " </param>"
|
|
|
+ " <param>"
|
|
|
+ " <value>"
|
|
|
+ " <array>"
|
|
|
+ " <data>"
|
|
|
+ " <value>apple</value>"
|
|
|
+ " <value>banana</value>"
|
|
|
+ " <value><string>lemon</string>peanuts</value>"
|
|
|
+ " </data>"
|
|
|
+ " </array>"
|
|
|
+ " </value>"
|
|
|
+ " </param>"
|
|
|
+ " </params>"
|
|
|
+ "</methodCall>");
|
|
|
+
|
|
|
+ CPPUNIT_ASSERT_EQUAL((size_t)4, req.params->size());
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("http://aria2.sourceforge.net"),
|
|
|
+ asString(req.params->get(0))->s());
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("http://aria2.sourceforge.net"),
|
|
|
+ asString(req.params->get(1))->s());
|
|
|
+ const Dict* dict = asDict(req.params->get(2));
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("world"),
|
|
|
+ asString(dict->get("hello"))->s());
|
|
|
+ const List* list = asList(req.params->get(3));
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("apple"), asString(list->get(0))->s());
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("banana"), asString(list->get(1))->s());
|
|
|
+ CPPUNIT_ASSERT_EQUAL(std::string("lemon"), asString(list->get(2))->s());
|
|
|
+}
|
|
|
+
|
|
|
} // namespace rpc
|
|
|
|
|
|
} // namespace aria2
|