summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Mons <edwin.mons@isode.com>2019-05-13 12:34:28 (GMT)
committerEdwin Mons <edwin.mons@isode.com>2019-05-13 12:56:27 (GMT)
commit09d8ac653493a0bd16cb69664ca28fbfe3c61bbb (patch)
treeba3c073d809949187622d1b26abf958f7299b2e3 /Swiften/Parser/UnitTest
parent16f15b8d80f648b61e991b04800c23368dcd38a5 (diff)
downloadswift-09d8ac653493a0bd16cb69664ca28fbfe3c61bbb.zip
swift-09d8ac653493a0bd16cb69664ca28fbfe3c61bbb.tar.bz2
Add flag to signal final XML data
XML parse now takes an optional boolean that will signal that with the data that is fed into the parser, the document should now be complete. This will allow the parser to reject partial documents. Test-Information: Updated unit tests pass. Checked that default behaviour wasn't changed. Tested with various partial and complete documents. Change-Id: Ide7c2e47c49d5667f1febcb23da366e96d0dbc21
Diffstat (limited to 'Swiften/Parser/UnitTest')
-rw-r--r--Swiften/Parser/UnitTest/XMLParserTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Swiften/Parser/UnitTest/XMLParserTest.cpp b/Swiften/Parser/UnitTest/XMLParserTest.cpp
index b593aa7..9e9012b 100644
--- a/Swiften/Parser/UnitTest/XMLParserTest.cpp
+++ b/Swiften/Parser/UnitTest/XMLParserTest.cpp
@@ -217,6 +217,15 @@ class XMLParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[1].data);
}
+ void testParse_CompleteDocument() {
+ ParserType testling(&client_);
+
+ CPPUNIT_ASSERT(!testling.parse("<iq", true));
+ CPPUNIT_ASSERT(!testling.parse("<iq>", true));
+ CPPUNIT_ASSERT(!testling.parse("<iq><child>foo</child>", true));
+ CPPUNIT_ASSERT(testling.parse("<iq><child>foo</child></iq>", true));
+ }
+
void testParse_WhitespaceInAttribute() {
ParserType testling(&client_);