From d9852a53afa8e0de632db6453685df87731ce27a Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Wed, 25 Mar 2015 10:17:49 +0300 Subject: [PATCH] If LoadFile() fails then subsequent successful LoadFile() must clear the error --- xmltest.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xmltest.cpp b/xmltest.cpp index 06ac9fc..ffff2f8 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -1434,6 +1434,17 @@ int main( int argc, const char ** argv ) newElement->Accept( &printer ); } + { + // If a document fails to load then subsequent + // successful loads should clear the error + XMLDocument doc; + doc.LoadFile( "resources/no-such-file.xml" ); + XMLTest( "No such file - should fail", true, doc.Error() ); + + doc.LoadFile( "resources/dream.xml" ); + XMLTest( "Error should be cleared", false, doc.Error() ); + } + // ----------- Performance tracking -------------- { #if defined( _MSC_VER )