summaryrefslogtreecommitdiff
path: root/tests/test_parse.cpp
AgeCommit message (Collapse)Author
2017-06-22tests: Make using namespace more explicitArseny Kapoulkine
Hiding using namespace in common.hpp is somewhat surprising so remove common.hpp and move using namespace into all .cpp files that need it.
2017-06-22tests: Remove redundant pugi:: qualifierArseny Kapoulkine
Most tests have `using namespace pugi` which makes explicit qualifications unnecessary.
2017-03-21tests: Fix invalid buffer sizeArseny Kapoulkine
This was triggering an buffer read overflow with asan.
2017-02-02tests: Add more embed_pcdata testsArseny Kapoulkine
2017-02-01tests: Improve parsing coverageArseny Kapoulkine
Add tests for PI erroring exactly at the buffer boundary with non-zero-terminated buffers (so we have to clear the last character which changes the parsing flow slightly) and a test that makes sure parse_embed_pcdata works properly with XML fragments where PCDATA can be at the root level but can't be embedded into the document node.
2017-02-01tests: Remove redundant coverage testArseny Kapoulkine
The only point was to try to test all paths where we can run out of memory while decoding something. It seems like it may be impossible to actually do this given that we can't run all paths as wchar_t size detection is done at runtime...
2017-01-31tests: Add more tests to increase coverageArseny Kapoulkine
This change adds more thorough tests for attribute conversion as well as some assorted tests that fix gaps in coverage.
2017-01-31tests: Add compact hash table reserve testArseny Kapoulkine
This makes sure all .reserve calls failure paths are covered. These tests don't explicitly test if reserve is present on all paths - this is much harder to test since not all modifications require reserve to be called, so we'll have to rely on a combination of automated testing and sanity checking for this. Also add more parsing out of memory coverage tests.
2017-01-31tests: Add coverage tests for encoding detectionArseny Kapoulkine
Enumerate successfull cases and also cases where the detection stops half-way and results in a different detected encoding.
2016-11-13Change status_end_element_mismatch to point to closing tag nameArseny Kapoulkine
Previously the error offset pointed to the first mismatching character, which can be confusing especially if the start tag name is a prefix of the end tag name. Instead, move the offset to the first character of the name - that way it should be more obvious that the problem is that the entire name mismatches. Fixes #112.
2016-07-15tests: Fix clang warningArseny Kapoulkine
2016-07-14tests: Add tests for latin1 detectionArseny Kapoulkine
2016-04-14Remove extra space in an empty tag for format_rawArseny Kapoulkine
When using format_raw the space in the empty tag (<node />) is the only character that does not have to be there; so format_raw almost results in a minimal XML but not quite. It's pretty unlikely that this is crucial for any users - the formatting change should be benign, and it's better to improve format_raw than to add yet another flag. Fixes #87.
2016-01-24test_parse.cpp: add newline to last lineStephan Beyer
This is necessary in order to comply with the C++03 standard.
2016-01-24Fix whitespace issuesStephan Beyer
Git warns when it finds "whitespace errors". This commit gets rid of these whitespace errors for code and adoc files.
2016-01-12tests: Add test for parse_embed_pcdataArseny Kapoulkine
2015-05-22tests: Fix MSVC6 compilationArseny Kapoulkine
2015-04-12tests: Add more out of memory testsArseny Kapoulkine
Also add tests that verify save_file for absence of FILE leaks.
2015-04-11tests: Improve out-of-memory testsArseny Kapoulkine
Previously there was no guarantee that the tests that check for out of memory handling behavior are actually correct - e.g. that they correctly simulate out of memory conditions. Now every simulated out of memory condition has to be "guarded" using CHECK_ALLOC_FAIL. It makes sure that every piece of code that is supposed to cause out-of-memory does so, and that no other code runs out of memory unnoticed.
2015-04-11tests: Add more out of memory testsArseny Kapoulkine
This provides more coverage for #17.
2015-03-12Fix buffer overrun when parsing comments inside DOCTYPEArseny Kapoulkine
2015-03-05tests: Move null buffer tests to test_documentArseny Kapoulkine
Remove size=0 test since a better test is already there.
2015-03-05Refactor contents=0 behaviorArseny Kapoulkine
Also change the error code to status_io_error
2015-03-05Merge branch 'master' of https://github.com/mloy/pugixml into mloy-masterArseny Kapoulkine
2014-11-17Rename xml_document::load to load_stringArseny Kapoulkine
This should completely eliminate the confusion between load and load_file. Of course, for compatibility reasons we have to preserve the old variant - it will be deprecated in a future version and subsequently removed.
2014-10-30load_buffer_impl always checks if buffer is valid pointer and size > 0mloy
added some tests to force invalid buffer and size = 0
2014-10-23tests: Add more tests for better coverageArseny Kapoulkine
More tests for out-of-memory and other edge conditions git-svn-id: https://pugixml.googlecode.com/svn/trunk@1075 99668b35-9821-0410-8761-19e4c4f06640
2014-10-23tests: Improve test coverageArseny Kapoulkine
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1074 99668b35-9821-0410-8761-19e4c4f06640
2014-10-02tests: Add missing tests to increase code coverageArseny Kapoulkine
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1038 99668b35-9821-0410-8761-19e4c4f06640
2014-02-25tests: Add tests for parse_trim_pcdata.Arseny Kapoulkine
git-svn-id: https://pugixml.googlecode.com/svn/trunk@988 99668b35-9821-0410-8761-19e4c4f06640
2014-02-23Fix clang build.Arseny Kapoulkine
git-svn-id: https://pugixml.googlecode.com/svn/trunk@986 99668b35-9821-0410-8761-19e4c4f06640
2014-02-23Fix gap collapsing during PCDATA parsing for fragment mode.Arseny Kapoulkine
git-svn-id: https://pugixml.googlecode.com/svn/trunk@985 99668b35-9821-0410-8761-19e4c4f06640
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-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-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
2011-12-09Introduced parse_ws_pcdata_single flag: only parses whitespace-only PCDATA ↵arseny.kapoulkine
if it's the only child of the parent node (middle ground between default flags and parse_ws_pcdata) git-svn-id: http://pugixml.googlecode.com/svn/trunk@825 99668b35-9821-0410-8761-19e4c4f06640
2010-09-20tests: Improved tests for parsing result default constructionarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@739 99668b35-9821-0410-8761-19e4c4f06640
2010-09-20tests: Added default ctor testarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@737 99668b35-9821-0410-8761-19e4c4f06640
2010-08-04tests: Added even more tests for better code coveragearseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@627 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-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-01parse_wnorm_attribute is no longer deprecated (it's part of W3C ↵arseny.kapoulkine
recommendations, after all) git-svn-id: http://pugixml.googlecode.com/svn/trunk@557 99668b35-9821-0410-8761-19e4c4f06640
2010-06-13tests: Added tests for parsing offset valuesarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@521 99668b35-9821-0410-8761-19e4c4f06640
2010-06-13Internal XML parsing error handling is done via setjmp/longjmp, all ↵arseny.kapoulkine
allocation errors are now handled correctly (parser returns status_out_of_memory, modification functions return errors); added tests for some out of memory situations git-svn-id: http://pugixml.googlecode.com/svn/trunk@520 99668b35-9821-0410-8761-19e4c4f06640
2010-06-12tests: Added non top-level declaration testarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@516 99668b35-9821-0410-8761-19e4c4f06640
2010-06-11tests: Fixed PI testarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@514 99668b35-9821-0410-8761-19e4c4f06640
2010-06-11tests: Added more (failing) declaration/PI testsarseny.kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@513 99668b35-9821-0410-8761-19e4c4f06640
2010-06-11Rewritten numeric character reference parsing (fixed &#; and &#x; parsing), ↵arseny.kapoulkine
added more character reference tests git-svn-id: http://pugixml.googlecode.com/svn/trunk@512 99668b35-9821-0410-8761-19e4c4f06640
2010-06-04Optimized attribute parsing; behavior of parse_wconv changed, it now assumes ↵arseny.kapoulkine
that parse_eol is set git-svn-id: http://pugixml.googlecode.com/svn/trunk@503 99668b35-9821-0410-8761-19e4c4f06640