summaryrefslogtreecommitdiff
path: root/tests/test_document.cpp
AgeCommit message (Collapse)Author
2014-02-11Implement document fragment parsing.Arseny Kapoulkine
Introduce a notable behavior change in default parsing mode: documents without a document element node are now considered invalid. This is technically a breaking change, however the amount of documents it affects is very small, all parsed data still persists, and lack of this check results in very confusing behavior in a number of cases. In order to be able to parse documents without an element node, a fragment parsing flag is introduced. Parsing a buffer in fragment mode treats the buffer as a fragment of a valid XML. As a consequence, top-level PCDATA is added to the tree; additionally, there are no restrictions on the number of nodes -- so documents without a document element are considered valid. Due to the way parsing works internally, load_buffer_inplace occasionally can not preserve the document contents if it's parsed in a fragment mode. While unfortunate, this problem is fundamental; since the use case is relatively obscure, hopefully documenting this shortcoming will be enough. git-svn-id: https://pugixml.googlecode.com/svn/trunk@980 99668b35-9821-0410-8761-19e4c4f06640
2014-02-10Fix clang build.Arseny Kapoulkine
git-svn-id: https://pugixml.googlecode.com/svn/trunk@978 99668b35-9821-0410-8761-19e4c4f06640
2014-02-10Use a null-terminated buffer for parsing as often as possible.Arseny Kapoulkine
Parsing used to work on a non null-terminated buffer, inserting a fake null terminator to increase performance. This makes it impossible to implement fragment parsing that preserves PCDATA contents (as witnessed by some tests for boundary conditions that actually depended on this behavior). Since almost all uses result in us allocating an internal buffer anyway, the new policy is to make sure all buffers that are allocated by pugixml are null-terminated - the only exception now is external calls to load_buffer_inplace that don't trigger encoding conversion. git-svn-id: https://pugixml.googlecode.com/svn/trunk@977 99668b35-9821-0410-8761-19e4c4f06640
2012-10-31tests: Remove 'con' loading from tests since it stopped working under ↵arseny.kapoulkine@gmail.com
Windows 8... git-svn-id: http://pugixml.googlecode.com/svn/trunk@921 99668b35-9821-0410-8761-19e4c4f06640
2012-03-23tests: Added text/binary save_file testsarseny.kapoulkine@gmail.com
git-svn-id: http://pugixml.googlecode.com/svn/trunk@884 99668b35-9821-0410-8761-19e4c4f06640
2012-03-06tests: Android compilation fixesarseny.kapoulkine@gmail.com
git-svn-id: http://pugixml.googlecode.com/svn/trunk@846 99668b35-9821-0410-8761-19e4c4f06640
2012-03-06tests: Use mkstemp on Unix and QNX (BlackBerry) to avoid tmpnam deprecation ↵arseny.kapoulkine@gmail.com
warning git-svn-id: http://pugixml.googlecode.com/svn/trunk@843 99668b35-9821-0410-8761-19e4c4f06640
2012-03-06tests: Fixed compilation errors for BadaSDKarseny.kapoulkine@gmail.com
git-svn-id: http://pugixml.googlecode.com/svn/trunk@839 99668b35-9821-0410-8761-19e4c4f06640
2012-02-19tests: Minor fixes for WinCE compilationarseny.kapoulkine@gmail.com
git-svn-id: http://pugixml.googlecode.com/svn/trunk@834 99668b35-9821-0410-8761-19e4c4f06640
2011-12-20Introduced encoding_latin1 support (conversion on loading, conversion on ↵arseny.kapoulkine
saving, encoding name in declaration in document::save) git-svn-id: http://pugixml.googlecode.com/svn/trunk@829 99668b35-9821-0410-8761-19e4c4f06640
2011-07-19tests: Added tests for non-seekable streamsarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@810 99668b35-9821-0410-8761-19e4c4f06640
2010-12-19Enabled many additional GCC warnings (most notably -Wshadow and ↵arseny.kapoulkine
-Wold-style-cast), fixed the code accordingly git-svn-id: http://pugixml.googlecode.com/svn/trunk@800 99668b35-9821-0410-8761-19e4c4f06640
2010-10-31tests: Added document reset-self testarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@787 99668b35-9821-0410-8761-19e4c4f06640
2010-10-31Added xml_document::reset() function with document parameterarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@786 99668b35-9821-0410-8761-19e4c4f06640
2010-10-26Added xml_document::reset, added append/prepend/insert child overloads for ↵arseny.kapoulkine
elements (with explicit name) git-svn-id: http://pugixml.googlecode.com/svn/trunk@779 99668b35-9821-0410-8761-19e4c4f06640
2010-10-22tests: Fixed WCHAR mode compilationarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@774 99668b35-9821-0410-8761-19e4c4f06640
2010-10-18Added xml_document::document_element functionarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@768 99668b35-9821-0410-8761-19e4c4f06640
2010-10-03tests: Fixed XPath OOM tests, added parsing exception testarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@760 99668b35-9821-0410-8761-19e4c4f06640
2010-09-20tests: Added load_file/save_file testsarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@742 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29tests: Removed some deprecated tests, minor coverage improvementsarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@687 99668b35-9821-0410-8761-19e4c4f06640
2010-08-29tests: Reduced allocation countarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@662 99668b35-9821-0410-8761-19e4c4f06640
2010-08-09tests: Added tests for short buffers (they duplicate the progressive ↵arseny.kapoulkine
truncation test, but it's better to have explicit tests) git-svn-id: http://pugixml.googlecode.com/svn/trunk@632 99668b35-9821-0410-8761-19e4c4f06640
2010-08-04tests: Fixed tests for wchar_t mode, added dummy std::cout/wcout usage for ↵arseny.kapoulkine
MSVC in order to create locales beforehand (avoids memory leaks during tests), minor additional test fixes git-svn-id: http://pugixml.googlecode.com/svn/trunk@629 99668b35-9821-0410-8761-19e4c4f06640
2010-08-04tests: Added more tests for better code coveragearseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@626 99668b35-9821-0410-8761-19e4c4f06640
2010-08-03tests: Preparations for custom new/delete (leak detection)arseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@620 99668b35-9821-0410-8761-19e4c4f06640
2010-07-22tests: Miscellaneous test fixesarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@618 99668b35-9821-0410-8761-19e4c4f06640
2010-07-22tests: Fixed warningarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@612 99668b35-9821-0410-8761-19e4c4f06640
2010-07-22tests: Added stream exception testarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@611 99668b35-9821-0410-8761-19e4c4f06640
2010-07-19Set svn:eol-style to native for all text filesarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@607 99668b35-9821-0410-8761-19e4c4f06640
2010-07-15tests: Added Xbox360 and PS3 toolset supportarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@602 99668b35-9821-0410-8761-19e4c4f06640
2010-06-27Renamed encoding_t to xml_encoding, renamed xpath_type_t to xpath_value_typearseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@544 99668b35-9821-0410-8761-19e4c4f06640
2010-06-12Declaration nodes improvements (they now automatically get name "xml", they ↵arseny.kapoulkine
can't be inserted as a non-document child, document saving prints declaration only if there is none present in the document) git-svn-id: http://pugixml.googlecode.com/svn/trunk@517 99668b35-9821-0410-8761-19e4c4f06640
2010-06-07tests: Added C++0x supportarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@505 99668b35-9821-0410-8761-19e4c4f06640
2010-06-02tests: Temporary file name is obtained via mkstemp on Unix systemsarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@499 99668b35-9821-0410-8761-19e4c4f06640
2010-06-02tests: Fixed test race condition (a better way would be to use ↵arseny.kapoulkine
argv[0]-relative path, but let's leave it like that till it breaks) git-svn-id: http://pugixml.googlecode.com/svn/trunk@494 99668b35-9821-0410-8761-19e4c4f06640
2010-05-20tests: Added progressive truncation testarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@436 99668b35-9821-0410-8761-19e4c4f06640
2010-05-10Added more testsarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@407 99668b35-9821-0410-8761-19e4c4f06640
2010-05-10Internal iterator constructors are now private, added empty document testarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@403 99668b35-9821-0410-8761-19e4c4f06640
2010-05-09Added empty stream/buffer tests, fixed null buffer parsing in wchar_t modearseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@397 99668b35-9821-0410-8761-19e4c4f06640
2010-05-08Deprecated all wildcard functions and parse_wnorm_attributearseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@389 99668b35-9821-0410-8761-19e4c4f06640
2010-05-06Integrated changes from unicode branch to trunkarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@383 99668b35-9821-0410-8761-19e4c4f06640
2010-04-20unicode: Fixed tests for Linuxarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@280 99668b35-9821-0410-8761-19e4c4f06640
2009-10-29tests: CodeWarrior and BCC supportedarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@195 99668b35-9821-0410-8761-19e4c4f06640
2009-10-29tests: Supported all pugixml compilation modesarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@191 99668b35-9821-0410-8761-19e4c4f06640
2009-10-28tests: More fixes and toolsets supportarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@190 99668b35-9821-0410-8761-19e4c4f06640
2009-10-28tests: Fixed MSVC warnings/errorsarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@185 99668b35-9821-0410-8761-19e4c4f06640
2009-10-20tests: Final core tests, 99.0% coverage for pugixml.cpparseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@166 99668b35-9821-0410-8761-19e4c4f06640
2009-10-20tests: Added more testsarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@162 99668b35-9821-0410-8761-19e4c4f06640
2009-10-20tests: Added declaration and document load/load_file error testsarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@157 99668b35-9821-0410-8761-19e4c4f06640
2009-10-12tests: Added document testsarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@154 99668b35-9821-0410-8761-19e4c4f06640