Просмотр исходного кода

add simple test for not-crashing

Lee Thomason 11 лет назад
Родитель
Сommit
92e521b431
2 измененных файлов с 10 добавлено и 0 удалено
  1. 2 0
      tinyxml2.h
  2. 8 0
      xmltest.cpp

+ 2 - 0
tinyxml2.h

@@ -186,6 +186,8 @@ public:
     char* ParseName( char* in );
 
 private:
+	void operator=(const StrPair& rhs);
+
     void Reset();
     void CollapseWhitespace();
 

+ 8 - 0
xmltest.cpp

@@ -1329,6 +1329,14 @@ int main( int argc, const char ** argv )
 		doc.Print();
 	}
 
+	{
+		// Test that it doesn't crash.
+		const char* xml = "<?xml version=\"1.0\"?><root><sample><field0><1</field0><field1>2</field1></sample></root>";
+		XMLDocument doc;
+		doc.Parse(xml);
+		doc.PrintError();
+	}
+
 #if 1
 		// the question being explored is what kind of print to use: 
 		// https://github.com/leethomason/tinyxml2/issues/63