blob: 81cc20711590f9908f9dc6636d95d0b0834e0740 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include "Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h"
#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadParserTester.h"
using namespace Swift;
class RawXMLPayloadParserTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(RawXMLPayloadParserTest);
CPPUNIT_TEST(testParse);
CPPUNIT_TEST_SUITE_END();
public:
RawXMLPayloadParserTest() {}
void testParse() {
RawXMLPayloadParser testling;
PayloadParserTester parser(&testling);
String xml =
"<foo foo-attr=\"foo-val\" xmlns=\"ns:foo\">"
"<bar bar-attr=\"bar-val\" xmlns=\"ns:bar\"/>"
"<baz baz-attr=\"baz-val\" xmlns=\"ns:baz\"/>"
"</foo>";
CPPUNIT_ASSERT(parser.parse(xml));
RawXMLPayload* payload = dynamic_cast<RawXMLPayload*>(testling.getPayload().get());
CPPUNIT_ASSERT_EQUAL(xml, payload->getRawXML());
}
};
CPPUNIT_TEST_SUITE_REGISTRATION(RawXMLPayloadParserTest);
|