diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2007-11-20 14:28:05 +0000 |
---|---|---|
committer | <> | 2013-08-08 17:01:04 +0000 |
commit | c97631728ce7d6d3f4692a56c3cda7476b42a968 (patch) | |
tree | 8c00053771ccae41a737eecd072dbb3cd8b06fdd /t/finish.t | |
download | perl-xml-parser-XML-Parser-2.36.tar.gz |
Imported from /home/lorry/working-area/delta_perl-xml-parser/XML-Parser-2.36.tar.gz.HEADXML-Parser-2.36master
Diffstat (limited to 't/finish.t')
-rw-r--r-- | t/finish.t | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/finish.t b/t/finish.t new file mode 100644 index 0000000..45cd86c --- /dev/null +++ b/t/finish.t @@ -0,0 +1,32 @@ +BEGIN {print "1..3\n";} +END {print "not ok 1\n" unless $loaded;} +use XML::Parser; +$loaded = 1; +print "ok 1\n"; + +my $stcount = 0; +my $encount = 0; + +sub st { + my ($exp, $el) = @_; + $stcount++; + $exp->finish if $el eq 'loc'; +} + +sub end { + $encount++; +} + +$parser = new XML::Parser(Handlers => {Start => \&st, + End => \&end + }, + ErrorContext => 2); + + +$parser->parsefile('samples/REC-xml-19980210.xml'); + +print "not " unless $stcount == 12; +print "ok 2\n"; + +print "not " unless $encount == 8; +print "ok 3\n"; |