summaryrefslogtreecommitdiff
path: root/ACEXML
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2003-01-29 16:49:25 +0000
committerSteve Huston <shuston@riverace.com>2003-01-29 16:49:25 +0000
commit5549425b7ce5becb13a08070263fa3e642a4bc9b (patch)
tree59edbe571e223e7a771eb5784708012d14a4bfb3 /ACEXML
parent1134abe360f4256f49bb6167fd9dd4e2739acf8a (diff)
downloadATCD-5549425b7ce5becb13a08070263fa3e642a4bc9b.tar.gz
ChangeLogTag:Wed Jan 29 11:47:29 2003 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ACEXML')
-rw-r--r--ACEXML/tests/ContentHandler_Test.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/ACEXML/tests/ContentHandler_Test.cpp b/ACEXML/tests/ContentHandler_Test.cpp
index ac4f6f324d6..b91557cb896 100644
--- a/ACEXML/tests/ContentHandler_Test.cpp
+++ b/ACEXML/tests/ContentHandler_Test.cpp
@@ -16,8 +16,6 @@
class Basic_Content_Tester : public ACEXML_DefaultHandler
{
public:
- Basic_Content_Tester (void) : status_ (0) {}
-
/**
* Receive notification of character data.
*/
@@ -29,10 +27,7 @@ public:
const ACEXML_Char *get_test_string (void)
{ return Basic_Content_Tester::test_string_; }
- int get_status (void) { return this->status_; }
-
private:
- int status_;
static const ACEXML_Char *test_string_;
};
@@ -45,40 +40,52 @@ void
Basic_Content_Tester::characters (const ACEXML_Char *ch,
int start,
int length ACEXML_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((ACEXML_SAXException))
{
static int already_called = 0;
- static ACEXML_Char *expect =
+ static const ACEXML_Char *expect =
ACE_TEXT ("Example\nd'internationalisation");
if (already_called)
{
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("Basic_Content_Tester::characters called too much\n")
- ));
- return;
+ ACEXML_THROW (ACEXML_SAXException
+ (ACE_TEXT ("characters() called too much\n")));
}
-
already_called = 1;
int expected_len = ACE_static_cast (int, ACE_OS::strlen (expect));
if (length != expected_len)
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("characters() expected len %d (%*s); ")
- ACE_TEXT ("got %d (%*s)\n"),
- expected_len, expected_len, ch + start,
- length, length, ch + start));
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("characters() expected len %d (%*s); ")
+ ACE_TEXT ("got %d (%*s)\n"),
+ expected_len, expected_len, ch + start,
+ length, length, ch + start));
+ ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Functionality failure")));
+ }
return;
}
int
ACE_TMAIN (int, ACE_TCHAR *[])
{
+ int status = 0;
Basic_Content_Tester tester;
ACEXML_StrCharStream *test_stream =
new ACEXML_StrCharStream (tester.get_test_string ());
ACEXML_InputSource input (test_stream);
ACEXML_Parser parser;
parser.setContentHandler (&tester);
- parser.parse (&input);
- return tester.get_status ();
+ ACEXML_TRY_NEW_ENV
+ {
+ parser.parse (&input ACEXML_ENV_ARG_PARAMETER);
+ ACEXML_TRY_CHECK;
+ }
+ ACEXML_CATCHANY
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("Caught exception.\n")));
+ status = 1;
+ }
+ ACEXML_ENDTRY;
+ return status;
}