diff options
author | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
commit | cfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch) | |
tree | 18d94153a302445196fc0c18586abf44a1ce4a38 /Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp | |
parent | 1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff) | |
download | swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2 |
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines
in the process.
Changed CheckTabs.py tool to disallow hard tabs in source
files.
Test-Information:
Manually checked 30 random files that the conversion worked
as expected.
Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp index 89c51d8..a8cf246 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp @@ -16,78 +16,78 @@ using namespace Swift; class MUCUserPayloadParserTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(MUCUserPayloadParserTest); - CPPUNIT_TEST(testParseEmpty); - CPPUNIT_TEST(testParse); - CPPUNIT_TEST(testParseDestroy); - CPPUNIT_TEST(testParseInvite); - CPPUNIT_TEST_SUITE_END(); - - public: - MUCUserPayloadParserTest() {} - - void testParse() { - PayloadsParserTester parser; - - CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><status code='110'/><item affiliation=\"owner\" role=\"visitor\"><actor jid=\"kev@tester.lit\"/><reason>malice</reason></item><status code='210'/></x>")); - - bool found110 = false; - bool found210 = false; - - MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); - - foreach (MUCUserPayload::StatusCode status, payload->getStatusCodes()) { - if (status.code == 110) found110 = true; - if (status.code == 210) found210 = true; - } - - MUCItem item = payload->getItems()[0]; - CPPUNIT_ASSERT_EQUAL(MUCOccupant::Owner, item.affiliation.get()); - CPPUNIT_ASSERT_EQUAL(MUCOccupant::Visitor, item.role.get()); - CPPUNIT_ASSERT_EQUAL(JID("kev@tester.lit"), item.actor.get()); - CPPUNIT_ASSERT_EQUAL(std::string("malice"), item.reason.get()); - CPPUNIT_ASSERT(found110); - CPPUNIT_ASSERT(found210); - } - - void testParseEmpty() { - PayloadsParserTester parser; - - CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"/>")); - - MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); - CPPUNIT_ASSERT(payload); - CPPUNIT_ASSERT(payload->getItems().empty()); - } - - void testParseDestroy() { - PayloadsParserTester parser; - - CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><destroy jid='alice@wonderland.lit'><reason>bert</reason></destroy></x>")); - - MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); - CPPUNIT_ASSERT(payload); - MUCDestroyPayload::ref destroy = boost::dynamic_pointer_cast<MUCDestroyPayload>(payload->getPayload()); - CPPUNIT_ASSERT(destroy); - CPPUNIT_ASSERT_EQUAL(std::string("bert"), destroy->getReason()); - CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit"), destroy->getNewVenue()); - } - - void testParseInvite() { - PayloadsParserTester parser; - - CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><invite from='crone1@shakespeare.lit/desktop' to='alice@wonderland.lit/xxx'> <reason>Hey Hecate, this is the place for all good witches!</reason> </invite> <password>cauldronburn</password></x>")); - - MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); - CPPUNIT_ASSERT(payload); - CPPUNIT_ASSERT(payload->getInvite()); - CPPUNIT_ASSERT(payload->getPassword()); - CPPUNIT_ASSERT_EQUAL(std::string("cauldronburn"), *payload->getPassword()); - MUCUserPayload::Invite invite = *payload->getInvite(); - CPPUNIT_ASSERT_EQUAL(std::string("Hey Hecate, this is the place for all good witches!"), invite.reason); - CPPUNIT_ASSERT_EQUAL(JID("crone1@shakespeare.lit/desktop"), invite.from); - CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit/xxx"), invite.to); - } + CPPUNIT_TEST_SUITE(MUCUserPayloadParserTest); + CPPUNIT_TEST(testParseEmpty); + CPPUNIT_TEST(testParse); + CPPUNIT_TEST(testParseDestroy); + CPPUNIT_TEST(testParseInvite); + CPPUNIT_TEST_SUITE_END(); + + public: + MUCUserPayloadParserTest() {} + + void testParse() { + PayloadsParserTester parser; + + CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><status code='110'/><item affiliation=\"owner\" role=\"visitor\"><actor jid=\"kev@tester.lit\"/><reason>malice</reason></item><status code='210'/></x>")); + + bool found110 = false; + bool found210 = false; + + MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); + + foreach (MUCUserPayload::StatusCode status, payload->getStatusCodes()) { + if (status.code == 110) found110 = true; + if (status.code == 210) found210 = true; + } + + MUCItem item = payload->getItems()[0]; + CPPUNIT_ASSERT_EQUAL(MUCOccupant::Owner, item.affiliation.get()); + CPPUNIT_ASSERT_EQUAL(MUCOccupant::Visitor, item.role.get()); + CPPUNIT_ASSERT_EQUAL(JID("kev@tester.lit"), item.actor.get()); + CPPUNIT_ASSERT_EQUAL(std::string("malice"), item.reason.get()); + CPPUNIT_ASSERT(found110); + CPPUNIT_ASSERT(found210); + } + + void testParseEmpty() { + PayloadsParserTester parser; + + CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"/>")); + + MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); + CPPUNIT_ASSERT(payload); + CPPUNIT_ASSERT(payload->getItems().empty()); + } + + void testParseDestroy() { + PayloadsParserTester parser; + + CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><destroy jid='alice@wonderland.lit'><reason>bert</reason></destroy></x>")); + + MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); + CPPUNIT_ASSERT(payload); + MUCDestroyPayload::ref destroy = boost::dynamic_pointer_cast<MUCDestroyPayload>(payload->getPayload()); + CPPUNIT_ASSERT(destroy); + CPPUNIT_ASSERT_EQUAL(std::string("bert"), destroy->getReason()); + CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit"), destroy->getNewVenue()); + } + + void testParseInvite() { + PayloadsParserTester parser; + + CPPUNIT_ASSERT(parser.parse("<x xmlns=\"http://jabber.org/protocol/muc#user\"><invite from='crone1@shakespeare.lit/desktop' to='alice@wonderland.lit/xxx'> <reason>Hey Hecate, this is the place for all good witches!</reason> </invite> <password>cauldronburn</password></x>")); + + MUCUserPayload::ref payload = boost::dynamic_pointer_cast<MUCUserPayload>(parser.getPayload()); + CPPUNIT_ASSERT(payload); + CPPUNIT_ASSERT(payload->getInvite()); + CPPUNIT_ASSERT(payload->getPassword()); + CPPUNIT_ASSERT_EQUAL(std::string("cauldronburn"), *payload->getPassword()); + MUCUserPayload::Invite invite = *payload->getInvite(); + CPPUNIT_ASSERT_EQUAL(std::string("Hey Hecate, this is the place for all good witches!"), invite.reason); + CPPUNIT_ASSERT_EQUAL(JID("crone1@shakespeare.lit/desktop"), invite.from); + CPPUNIT_ASSERT_EQUAL(JID("alice@wonderland.lit/xxx"), invite.to); + } }; |