From a820665eea71a64b40e74ed24afeaf07a7a99db4 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 26 May 2006 14:36:57 +0000 Subject: Added the first of many unit tests. For now the unit tests are just built with everything else in the all target of the makefile, which is fine, but relies on CppTest, which can be found at http://cpptest.sf.net Also fixed some things I've been meaning to get to for a while in the xml system, including a few bugs that will make coping with malformed data not hang other programs, and do the error reporting in a nice way. --- src/xmlfilereader.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/xmlfilereader.cpp') diff --git a/src/xmlfilereader.cpp b/src/xmlfilereader.cpp index 216c08a..dd4bc82 100644 --- a/src/xmlfilereader.cpp +++ b/src/xmlfilereader.cpp @@ -1,4 +1,5 @@ #include "xmlfilereader.h" +#include "xmlexception.h" #include XmlFileReader::XmlFileReader( const char *sFile, bool bStrip ) @@ -8,7 +9,7 @@ XmlFileReader::XmlFileReader( const char *sFile, bool bStrip ) if( fh == NULL ) { - reportError("Couldn't open file."); + throw XmlException("Couldn't open file: %s", sFile ); //nError = 1; } else @@ -50,7 +51,7 @@ char XmlFileReader::getChar( int nIndex ) } else { - return '\0'; + throw XmlException("End of XML stream read."); } } -- cgit v1.2.3