fix up error system issues

This commit is contained in:
Lee Thomason
2017-10-11 10:57:49 -07:00
parent 714ccfe29b
commit f49b9658bb
3 changed files with 47 additions and 43 deletions

View File

@@ -499,13 +499,9 @@ int main( int argc, const char ** argv )
int value2 = doc->FirstChildElement()->LastChildElement()->IntAttribute( "attrib", replacementIntValue );
XMLError result = doc->FirstChildElement()->LastChildElement()->QueryIntAttribute( "attrib", &value1 );
XMLTest( "Programmatic DOM", XML_NO_ATTRIBUTE, result );
doc->PrintError();
XMLTest( "Programmatic DOM", defaultIntValue, value1 );
XMLTest( "Programmatic DOM", replacementIntValue, value2 );
exit(0);
doc->Print();
{
@@ -1958,11 +1954,9 @@ int main( int argc, const char ** argv )
XMLDocument doc;
for( int i = 0; i < XML_ERROR_COUNT; i++ ) {
const XMLError error = static_cast<XMLError>(i);
doc.SetError( error, 0, 0, 0 );
XMLTest( "ErrorID() after SetError()", error, doc.ErrorID() );
const char* name = doc.ErrorName();
XMLTest( "ErrorName() after SetError()", true, name != 0 );
XMLTest( "ErrorName() after SetError()", true, strlen(name) > 0 );
const char* name = XMLDocument::ErrorIDToName(error);
XMLTest( "ErrorName() after ClearError()", true, name != 0 );
XMLTest( "ErrorName() after ClearError()", true, strlen(name) > 0 );
}
}
@@ -2060,7 +2054,7 @@ int main( int argc, const char ** argv )
XMLTest(testString, parseError, doc.ErrorID());
XMLTest(testString, true, doc.Error());
XMLTest(testString, expected_error, parseError);
XMLTest(testString, expectedLine, doc.GetErrorLineNum());
XMLTest(testString, expectedLine, doc.ErrorLineNum());
};
void TestStringLines(const char *testString, const char *docStr, const char *expectedLines)
@@ -2178,6 +2172,18 @@ int main( int argc, const char ** argv )
"D01L01E02E03A03A03T03E04A04A04T04E05A05A05T05E06A06A06T06E07A07A07T07E08A08A08T08E09T09E10T10");
}
{
const char* xml = "<Hello>Text</Error>";
XMLDocument doc;
doc.Parse(xml);
XMLTest("Test mismatched elements.", true, doc.Error());
XMLTest("Test mismatched elements.", XML_ERROR_MISMATCHED_ELEMENT, doc.ErrorID());
// For now just make sure calls work & doesn't crash.
// May solidify the error output in the future.
printf("%s\n", doc.ErrorStr());
doc.PrintError();
}
// ----------- Performance tracking --------------
{
#if defined( _MSC_VER )