mirror of https://github.com/AxioDL/tinyxml2.git
Merge pull request #580 from Dmitry-Me/checkLoadSaveResult
Check result of LoadFile()/SaveFile()
This commit is contained in:
commit
80379a331d
10
xmltest.cpp
10
xmltest.cpp
|
@ -461,7 +461,9 @@ int main( int argc, const char ** argv )
|
|||
XMLTest( "Compact mode", "<element><sub attrib=\"true\"/><sub/></element>", streamer.CStr(), false );
|
||||
}
|
||||
doc->SaveFile( "./resources/out/pretty.xml" );
|
||||
XMLTest( "Save pretty.xml", false, doc->Error() );
|
||||
doc->SaveFile( "./resources/out/compact.xml", true );
|
||||
XMLTest( "Save compact.xml", false, doc->Error() );
|
||||
delete doc;
|
||||
}
|
||||
{
|
||||
|
@ -471,8 +473,10 @@ int main( int argc, const char ** argv )
|
|||
//int newStart = gNew;
|
||||
XMLDocument doc;
|
||||
doc.LoadFile( "resources/dream.xml" );
|
||||
XMLTest( "Load dream.xml", false, doc.Error() );
|
||||
|
||||
doc.SaveFile( "resources/out/dreamout.xml" );
|
||||
XMLTest( "Save dreamout.xml", false, doc.Error() );
|
||||
doc.PrintError();
|
||||
|
||||
XMLTest( "Dream", "xml version=\"1.0\"",
|
||||
|
@ -487,6 +491,7 @@ int main( int argc, const char ** argv )
|
|||
|
||||
XMLDocument doc2;
|
||||
doc2.LoadFile( "resources/out/dreamout.xml" );
|
||||
XMLTest( "Load dreamout.xml", false, doc2.Error() );
|
||||
XMLTest( "Dream-out", "xml version=\"1.0\"",
|
||||
doc2.FirstChild()->ToDeclaration()->Value() );
|
||||
XMLTest( "Dream-out", true, doc2.FirstChild()->NextSibling()->ToUnknown() ? true : false );
|
||||
|
@ -582,6 +587,7 @@ int main( int argc, const char ** argv )
|
|||
{
|
||||
XMLDocument doc;
|
||||
doc.LoadFile( "resources/utf8test.xml" );
|
||||
XMLTest( "Load utf8test.xml", false, doc.Error() );
|
||||
|
||||
// Get the attribute "value" from the "Russian" element and check it.
|
||||
XMLElement* element = doc.FirstChildElement( "document" )->FirstChildElement( "Russian" );
|
||||
|
@ -603,6 +609,7 @@ int main( int argc, const char ** argv )
|
|||
|
||||
// Now try for a round trip.
|
||||
doc.SaveFile( "resources/out/utf8testout.xml" );
|
||||
XMLTest( "UTF-8: Save testout.xml", false, doc.Error() );
|
||||
|
||||
// Check the round trip.
|
||||
int okay = 0;
|
||||
|
@ -1432,6 +1439,7 @@ int main( int argc, const char ** argv )
|
|||
doc.Clear();
|
||||
XMLTest( "Empty is empty after Clear()", true, doc.NoChildren() );
|
||||
doc.LoadFile( "resources/dream.xml" );
|
||||
XMLTest( "Load dream.xml", false, doc.Error() );
|
||||
XMLTest( "Document has something to Clear()", false, doc.NoChildren() );
|
||||
doc.Clear();
|
||||
XMLTest( "Document Clear()'s", true, doc.NoChildren() );
|
||||
|
@ -1521,10 +1529,12 @@ int main( int argc, const char ** argv )
|
|||
|
||||
XMLTest( "BOM preservation (compare)", xml_bom_preservation, printer.CStr(), false, true );
|
||||
doc.SaveFile( "resources/bomtest.xml" );
|
||||
XMLTest( "Save bomtest.xml", false, doc.Error() );
|
||||
}
|
||||
{
|
||||
XMLDocument doc;
|
||||
doc.LoadFile( "resources/bomtest.xml" );
|
||||
XMLTest( "Load bomtest.xml", false, doc.Error() );
|
||||
XMLTest( "BOM preservation (load)", true, doc.HasBOM(), false );
|
||||
|
||||
XMLPrinter printer;
|
||||
|
|
Loading…
Reference in New Issue