summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-09-05 11:01:20 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-09-05 11:01:20 (GMT)
commit0630c01cf274a9de6b67856b8c00b1503b39353e (patch)
treed304c6510063ddd7ba5eb934e92f93f7222e3b41 /Swiften/Parser/PayloadParsers/UnitTest
parent840dc1e190cfdfdc9ec88f9f2db3a507221c96bc (diff)
downloadswift-0630c01cf274a9de6b67856b8c00b1503b39353e.zip
swift-0630c01cf274a9de6b67856b8c00b1503b39353e.tar.bz2
Don't lose unknown roster content.
Resolves: #555
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest')
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp
index e085d58..aea9dc4 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp
@@ -16,6 +16,7 @@ class RosterParserTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(RosterParserTest);
CPPUNIT_TEST(testParse);
+ CPPUNIT_TEST(testParse_ItemWithUnknownContent);
CPPUNIT_TEST_SUITE_END();
public:
@@ -51,6 +52,30 @@ class RosterParserTest : public CppUnit::TestFixture
CPPUNIT_ASSERT(!items[1].getSubscriptionRequested());
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), items[1].getGroups().size());
}
+
+ void testParse_ItemWithUnknownContent() {
+ PayloadsParserTester parser;
+ parser.parse(
+ "<query xmlns='jabber:iq:roster'>"
+ " <item jid='foo@bar.com' name='Foo @ Bar' subscription='from' ask='subscribe'>"
+ " <group>Group 1</group>"
+ " <foo xmlns=\"http://example.com\"><bar>Baz</bar></foo>"
+ " <group>Group 2</group>"
+ " <baz><fum>foo</fum></baz>"
+ " </item>"
+ "</query>");
+
+ RosterPayload* payload = dynamic_cast<RosterPayload*>(parser.getPayload().get());
+ const RosterPayload::RosterItemPayloads& items = payload->getItems();
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), items.size());
+ CPPUNIT_ASSERT_EQUAL(String("Group 1"), items[0].getGroups()[0]);
+ CPPUNIT_ASSERT_EQUAL(String("Group 2"), items[0].getGroups()[1]);
+ CPPUNIT_ASSERT_EQUAL(String(
+ "<foo xmlns=\"http://example.com\"><bar xmlns=\"http://example.com\">Baz</bar></foo>"
+ "<baz xmlns=\"jabber:iq:roster\"><fum xmlns=\"jabber:iq:roster\">foo</fum></baz>"
+ ), items[0].getUnknownContent());
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(RosterParserTest);