mirror of
https://github.com/AxioDL/tinyxml2.git
synced 2025-05-14 19:31:23 +00:00
Test there's no error initially, proper swap "found" and "expected"
This commit is contained in:
parent
a1a4a13825
commit
32533ca9c2
@ -1439,16 +1439,18 @@ int main( int argc, const char ** argv )
|
|||||||
{
|
{
|
||||||
// Issue 302. Clear errors from LoadFile/SaveFile
|
// Issue 302. Clear errors from LoadFile/SaveFile
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
|
XMLTest( "Issue 302. Should be no error initially", "XML_SUCCESS", doc.ErrorName() );
|
||||||
doc.SaveFile( "./no/such/path/pretty.xml" );
|
doc.SaveFile( "./no/such/path/pretty.xml" );
|
||||||
XMLTest( "Issue 302. Fail to save", doc.ErrorName(), "XML_ERROR_FILE_COULD_NOT_BE_OPENED" );
|
XMLTest( "Issue 302. Fail to save", "XML_ERROR_FILE_COULD_NOT_BE_OPENED", doc.ErrorName() );
|
||||||
doc.SaveFile( "./resources/out/compact.xml", true );
|
doc.SaveFile( "./resources/out/compact.xml", true );
|
||||||
XMLTest( "Issue 302. Subsequent success in saving", doc.ErrorName(), "XML_SUCCESS" );
|
XMLTest( "Issue 302. Subsequent success in saving", "XML_SUCCESS", doc.ErrorName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// If a document fails to load then subsequent
|
// If a document fails to load then subsequent
|
||||||
// successful loads should clear the error
|
// successful loads should clear the error
|
||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
|
XMLTest( "Should be no error initially", false, doc.Error() );
|
||||||
doc.LoadFile( "resources/no-such-file.xml" );
|
doc.LoadFile( "resources/no-such-file.xml" );
|
||||||
XMLTest( "No such file - should fail", true, doc.Error() );
|
XMLTest( "No such file - should fail", true, doc.Error() );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user