diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp new file mode 100644 index 0000000..71d5b0b --- /dev/null +++ b/Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp @@ -0,0 +1,28 @@ +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/extensions/TestFactoryRegistry.h> + +#include "Swiften/Parser/PayloadParsers/StatusParser.h" +#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h" + +using namespace Swift; + +class StatusParserTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE(StatusParserTest); + CPPUNIT_TEST(testParse); + CPPUNIT_TEST_SUITE_END(); + + public: + StatusParserTest() {} + + void testParse() { + PayloadsParserTester parser; + + CPPUNIT_ASSERT(parser.parse("<status>foo<baz>bar</baz>fum</status>")); + + Status* payload = dynamic_cast<Status*>(parser.getPayload().get()); + CPPUNIT_ASSERT_EQUAL(String("foobarfum"), payload->getText()); + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(StatusParserTest); |