You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2002/03/28 08:51:13 UTC
cvs commit: xml-xerces/perl/t PerlErrorHandler.t
jasons 02/03/27 23:51:13
Modified: perl/t PerlErrorHandler.t
Log:
* t/PerlErrorHandler.t (Repository):
added new test for re-defining the error handler
fails to return an object
Revision Changes Path
1.6 +30 -2 xml-xerces/perl/t/PerlErrorHandler.t
Index: PerlErrorHandler.t
===================================================================
RCS file: /home/cvs/xml-xerces/perl/t/PerlErrorHandler.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PerlErrorHandler.t 7 Oct 2001 02:51:41 -0000 1.5
+++ PerlErrorHandler.t 28 Mar 2002 07:51:13 -0000 1.6
@@ -7,10 +7,10 @@
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
-BEGIN { $| = 1; print "1..3\n"; }
+BEGIN { $| = 1; print "1..6\n"; }
END {print "not ok 1\n" unless $loaded;}
use Carp;
-# use blib;
+use blib;
use XML::Xerces;
use lib 't';
@@ -148,6 +148,34 @@
my $error_handler = MyErrorHandler->new();
$dom->setErrorHandler($error_handler);
+
+ $dom->setValidationScheme($XML::Xerces::DOMParser::Val_Always);
+ eval {
+ $dom->parse(XML::Xerces::MemBufInputSource->new($document, 'foo') );
+ };
+
+ my $expected_error = <<EOE;
+ERROR:
+LINE: 4
+COLUMN: 11
+MESSAGE: Unknown element 'personnel'
+EOE
+ result($expected_error eq $error);
+}
+
+# test redefining the handler
+{
+ $error = "";
+
+ my $dom = XML::Xerces::DOMParser->new();
+
+ my $error_handler = MyErrorHandler->new();
+ my $error_handler2 = MyErrorHandler->new();
+ my $tmp = $dom->setErrorHandler($error_handler);
+ result(!defined $tmp);
+
+ $tmp = $dom->setErrorHandler($error_handler2);
+ result(defined $tmp);
$dom->setValidationScheme($XML::Xerces::DOMParser::Val_Always);
eval {
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org