summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-07-12 18:43:33 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-07-12 18:43:33 (GMT)
commit08536b4ed31c30a25a343c3c2619676e67a0c692 (patch)
tree744066e3373bc1e27e9b4d18fd0c1b25d4da5878 /Swiften/JID/UnitTest/JIDTest.cpp
parentd181db064ee10c23f0f126f2feb0329ee2236d4c (diff)
downloadswift-contrib-08536b4ed31c30a25a343c3c2619676e67a0c692.zip
swift-contrib-08536b4ed31c30a25a343c3c2619676e67a0c692.tar.bz2
Fixed bug with illegal resource in JID resulting in empty resource.
Diffstat (limited to 'Swiften/JID/UnitTest/JIDTest.cpp')
-rw-r--r--Swiften/JID/UnitTest/JIDTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Swiften/JID/UnitTest/JIDTest.cpp b/Swiften/JID/UnitTest/JIDTest.cpp
index 0f22e15..f406635 100644
--- a/Swiften/JID/UnitTest/JIDTest.cpp
+++ b/Swiften/JID/UnitTest/JIDTest.cpp
@@ -17,18 +17,19 @@ class JIDTest : public CppUnit::TestFixture
CPPUNIT_TEST(testConstructorWithString);
CPPUNIT_TEST(testConstructorWithString_NoResource);
CPPUNIT_TEST(testConstructorWithString_NoNode);
CPPUNIT_TEST(testConstructorWithString_EmptyResource);
CPPUNIT_TEST(testConstructorWithString_OnlyDomain);
CPPUNIT_TEST(testConstructorWithString_UpperCaseNode);
CPPUNIT_TEST(testConstructorWithString_UpperCaseDomain);
CPPUNIT_TEST(testConstructorWithString_UpperCaseResource);
CPPUNIT_TEST(testConstructorWithString_EmptyNode);
+ CPPUNIT_TEST(testConstructorWithString_IllegalResource);
CPPUNIT_TEST(testConstructorWithStrings);
CPPUNIT_TEST(testIsBare);
CPPUNIT_TEST(testIsBare_NotBare);
CPPUNIT_TEST(testToBare);
CPPUNIT_TEST(testToBare_EmptyNode);
CPPUNIT_TEST(testToBare_EmptyResource);
CPPUNIT_TEST(testToString);
CPPUNIT_TEST(testToString_EmptyNode);
CPPUNIT_TEST(testToString_EmptyResource);
@@ -118,18 +119,24 @@ class JIDTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(testling.getResource(), std::string("Fo\xCE\xA9"));
}
void testConstructorWithString_EmptyNode() {
JID testling("@bar");
CPPUNIT_ASSERT(!testling.isValid());
}
+ void testConstructorWithString_IllegalResource() {
+ JID testling("foo@bar.com/\xd8\xb1\xd9\x85\xd9\x82\xd9\x87\x20\xd8\xaa\xd8\xb1\xd9\x86\xd8\xb3\x20");
+
+ CPPUNIT_ASSERT(!testling.isValid());
+ }
+
void testConstructorWithStrings() {
JID testling("foo", "bar", "baz");
CPPUNIT_ASSERT_EQUAL(std::string("foo"), testling.getNode());
CPPUNIT_ASSERT_EQUAL(std::string("bar"), testling.getDomain());
CPPUNIT_ASSERT_EQUAL(std::string("baz"), testling.getResource());
}
void testIsBare() {