소스 검색

If LoadFile() fails then subsequent successful LoadFile() must clear the error

Dmitry-Me 11 년 전
부모
커밋
d9852a53af
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      xmltest.cpp

+ 11 - 0
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 )