Selaa lähdekoodia

Merge pull request #305 from Dmitry-Me/errorShouldBeClearedAfterLoad

If LoadFile() fails then subsequent successful LoadFile() must clear the error
Lee Thomason 11 vuotta sitten
vanhempi
commit
28c7c8c14f
1 muutettua tiedostoa jossa 11 lisäystä ja 0 poistoa
  1. 11 0
      xmltest.cpp

+ 11 - 0
xmltest.cpp

@@ -1442,6 +1442,17 @@ int main( int argc, const char ** argv )
 		XMLTest( "Issue 302. Subsequent success in saving", doc.ErrorName(), "XML_SUCCESS" );
 		XMLTest( "Issue 302. Subsequent success in saving", doc.ErrorName(), "XML_SUCCESS" );
 	}
 	}
 
 
+	{
+		// 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 --------------
 	// ----------- Performance tracking --------------
 	{
 	{
 #if defined( _MSC_VER )
 #if defined( _MSC_VER )