tests: Miscellaneous test fixes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@618 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
6b69701cdd
commit
958ee27e7f
@ -108,15 +108,17 @@ TEST(document_load_stream_exceptions)
|
|||||||
{
|
{
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
|
|
||||||
|
// Windows has newline translation for text-mode files, so reading from this stream reaches eof and sets fail|eof bits.
|
||||||
|
// This test does not cause stream to throw an exception on Linux - I have no idea how to get read() to fail except
|
||||||
|
// newline translation.
|
||||||
std::ifstream iss("tests/data/multiline.xml");
|
std::ifstream iss("tests/data/multiline.xml");
|
||||||
iss.exceptions(std::ios::eofbit);
|
iss.exceptions(std::ios::eofbit | std::ios::badbit | std::ios::failbit);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
doc.load(iss);
|
doc.load(iss);
|
||||||
|
|
||||||
volatile bool exception_should_be_thrown = false; // to avoid 'controlling expression is constant' warning
|
CHECK(iss.good()); // if the exception was not thrown, stream reading should succeed without errors
|
||||||
CHECK(exception_should_be_thrown);
|
|
||||||
}
|
}
|
||||||
catch (const std::ios_base::failure&)
|
catch (const std::ios_base::failure&)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -52,7 +52,7 @@ TEST_XML(xpath_sort_complex, "<node><child1 attr1='value1' attr2='value2'/><chil
|
|||||||
TEST(xpath_sort_complex_copy) // copy the document so that document order optimization does not work
|
TEST(xpath_sort_complex_copy) // copy the document so that document order optimization does not work
|
||||||
{
|
{
|
||||||
xml_document doc;
|
xml_document doc;
|
||||||
load_document_copy(doc, "<node><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>");
|
load_document_copy(doc, STR("<node><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>"));
|
||||||
|
|
||||||
// just some random union order, it should not matter probably?
|
// just some random union order, it should not matter probably?
|
||||||
xpath_node_set ns = doc.child(STR("node")).select_nodes(STR("child1 | child2 | child1/@* | . | child2/@* | child2/text()"));
|
xpath_node_set ns = doc.child(STR("node")).select_nodes(STR("child1 | child2 | child1/@* | . | child2/@* | child2/text()"));
|
||||||
@ -84,7 +84,7 @@ TEST_XML(xpath_sort_children, "<node><child><subchild id='1'/></child><child><su
|
|||||||
TEST(xpath_sort_children_copy) // copy the document so that document order optimization does not work
|
TEST(xpath_sort_children_copy) // copy the document so that document order optimization does not work
|
||||||
{
|
{
|
||||||
xml_document doc;
|
xml_document doc;
|
||||||
load_document_copy(doc, "<node><child><subchild id='1'/></child><child><subchild id='2'/></child></node>");
|
load_document_copy(doc, STR("<node><child><subchild id='1'/></child><child><subchild id='2'/></child></node>"));
|
||||||
|
|
||||||
xpath_node_set ns = doc.child(STR("node")).select_nodes(STR("child/subchild[@id=1] | child/subchild[@id=2]"));
|
xpath_node_set ns = doc.child(STR("node")).select_nodes(STR("child/subchild[@id=1] | child/subchild[@id=2]"));
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user