summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-11 15:51:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-11 15:56:10 (GMT)
commit1d6d6588e3affc9a736b29062107ca82ad6a5644 (patch)
tree54a96dd3f652df321ed5017148811d241baa1dd8 /Swiften/Parser/PayloadParsers/UnitTest
parente1a2d258479cd915e8c30c5c996b58da3da3e55d (diff)
downloadswift-contrib-1d6d6588e3affc9a736b29062107ca82ad6a5644.zip
swift-contrib-1d6d6588e3affc9a736b29062107ca82ad6a5644.tar.bz2
Added Raw XML payload parser & serializer.
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest')
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/Makefile.inc3
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp34
2 files changed, 36 insertions, 1 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/Makefile.inc b/Swiften/Parser/PayloadParsers/UnitTest/Makefile.inc
index 26f7b3c..d7d419e 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/Makefile.inc
+++ b/Swiften/Parser/PayloadParsers/UnitTest/Makefile.inc
@@ -11,4 +11,5 @@ UNITTEST_SOURCES += \
Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp \
Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp \
Swiften/Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp \
- Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp
+ Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp \
+ Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp
new file mode 100644
index 0000000..5a2be8d
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp
@@ -0,0 +1,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=\"foo-ns\">"
+ "<bar bar-attr=\"bar-val\" xmlns=\"bar-ns\"/>"
+ "<baz baz-attr=\"baz-val\" xmlns=\"baz-ns\"/>"
+ "</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);