summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-08-24 16:26:33 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-08-24 16:26:33 (GMT)
commitbe0d72c3ad4790447dfb9d0c439971cfd7dcc2fc (patch)
tree6945d28a21203bbfceca5a0433c7534e98e15fae /Swiften/Parser/UnitTest/XMLParserTest.cpp
parente7089e0c45e43af5aa39f9d1e5d7582c830d3fbf (diff)
downloadswift-be0d72c3ad4790447dfb9d0c439971cfd7dcc2fc.zip
swift-be0d72c3ad4790447dfb9d0c439971cfd7dcc2fc.tar.bz2
Work around LibXML failing on namespace errors/warnings.
Diffstat (limited to 'Swiften/Parser/UnitTest/XMLParserTest.cpp')
-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 {