fix incorrect assert on unused memory

This commit is contained in:
Lee Thomason
2012-11-19 13:54:42 -08:00
parent 998116e587
commit 5b0a677712
4 changed files with 50 additions and 23 deletions

View File

@@ -1,5 +1,8 @@
#include "tinyxml2.h"
#if defined( _MSC_VER )
#define _CRT_SECURE_NO_WARNINGS // This test file is not intended to be secure.
#endif
#include "tinyxml2.h"
#include <cstdlib>
#include <cstring>
#include <ctime>
@@ -975,6 +978,15 @@ int main( int /*argc*/, const char ** /*argv*/ )
}
#endif
{
// An assert should not fire.
const char* xml = "<element/>";
XMLDocument doc;
doc.Parse( xml );
XMLElement* ele = doc.NewElement( "unused" ); // This will get cleaned up with the 'doc' going out of scope.
XMLTest( "Tracking unused elements", true, ele != 0, false );
}
// ----------- Performance tracking --------------
{
#if defined( _MSC_VER )