summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-12 16:20:23 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-12 16:20:44 (GMT)
commiteb788bf484f4d11f524473986bf19d1a80f522bc (patch)
treeec5c4a32dbc7169414e05fd13457578762be9443 /Swiften/Parser/PayloadParsers/UnitTest
parent3a876559c905f324e4bc91cec6c58d93160a5a9d (diff)
downloadswift-contrib-eb788bf484f4d11f524473986bf19d1a80f522bc.zip
swift-contrib-eb788bf484f4d11f524473986bf19d1a80f522bc.tar.bz2
Don't assert on incorrect priorities.
Release-Notes: We don't crash anymore when a contact has set an incorrect priority
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest')
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
index 7c18762..b340739 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
@@ -12,15 +12,13 @@
using namespace Swift;
-class PriorityParserTest : public CppUnit::TestFixture
-{
+class PriorityParserTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(PriorityParserTest);
CPPUNIT_TEST(testParse);
+ CPPUNIT_TEST(testParse_Invalid);
CPPUNIT_TEST_SUITE_END();
public:
- PriorityParserTest() {}
-
void testParse() {
PayloadsParserTester parser;
@@ -29,6 +27,15 @@ class PriorityParserTest : public CppUnit::TestFixture
Priority* payload = dynamic_cast<Priority*>(parser.getPayload().get());
CPPUNIT_ASSERT_EQUAL(-120, payload->getPriority());
}
+
+ void testParse_Invalid() {
+ PayloadsParserTester parser;
+
+ CPPUNIT_ASSERT(parser.parse("<priority>invalid</priority>"));
+
+ Priority* payload = dynamic_cast<Priority*>(parser.getPayload().get());
+ CPPUNIT_ASSERT_EQUAL(0, payload->getPriority());
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(PriorityParserTest);