summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/UnitTest')
-rw-r--r--Swiften/Parser/UnitTest/XMLParserTest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/Swiften/Parser/UnitTest/XMLParserTest.cpp b/Swiften/Parser/UnitTest/XMLParserTest.cpp
index 7b4b38e..2aae4cd 100644
--- a/Swiften/Parser/UnitTest/XMLParserTest.cpp
+++ b/Swiften/Parser/UnitTest/XMLParserTest.cpp
@@ -30,6 +30,7 @@ class XMLParserTest : public CppUnit::TestFixture {
CPPUNIT_TEST(testParse_InvalidXML);
CPPUNIT_TEST(testParse_InErrorState);
CPPUNIT_TEST(testParse_Incremental);
+ CPPUNIT_TEST(testParse_WhitespaceInAttribute);
CPPUNIT_TEST_SUITE_END();
public:
@@ -188,6 +189,22 @@ class XMLParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[1].type);
CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[1].data);
}
+
+ void testParse_WhitespaceInAttribute() {
+ ParserType testling(&client_);
+
+ CPPUNIT_ASSERT(testling.parse(
+ "<query xmlns='http://www.xmpp.org/extensions/xep-0084.html#ns-data '>"));
+ CPPUNIT_ASSERT(testling.parse(
+ "<presence/>"));
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), client_.events.size());
+ CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type);
+ CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[0].data);
+ CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[1].type);
+ CPPUNIT_ASSERT_EQUAL(String("presence"), client_.events[1].data);
+ CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[2].type);
+ CPPUNIT_ASSERT_EQUAL(String("presence"), client_.events[2].data);
+ }
private:
class Client : public XMLParserClient {