File: 61error.t

package info (click to toggle)
libxml-libxml-perl 2.0207%2Bdfsg%2Breally%2B2.0134-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,572 kB
  • sloc: perl: 6,310; ansic: 3,851; xml: 182; sh: 21; makefile: 16
file content (35 lines) | stat: -rw-r--r-- 577 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

use strict;
use warnings;

use Test::More;
use XML::LibXML;

use XML::LibXML::Error;

if (! XML::LibXML::HAVE_STRUCT_ERRORS() ) {
    plan skip_all => 'XML::LibXML does not have struct errrors.';
}
else
{
    plan tests => 3;
}

my $p = XML::LibXML->new();

my $xmlstr = <<EOX;
<X></Y>
EOX

eval {
    my $doc = $p->parse_string( $xmlstr );
};

my $err = $@;
# TEST
isa_ok ($err, "XML::LibXML::Error", 'Exception is of type error.');
# TEST
is ($err->domain(), 'parser', 'Error is in the parser domain');
# TEST
is ($err->line(), 1, 'Error is on line 1.');
# warn "se: ", $@;