Skip to content

Commit

Permalink
Fix test suite with libxml2 2.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nwellnhof committed May 21, 2024
1 parent 3c66d6d commit 482715a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
7 changes: 6 additions & 1 deletion t/02parse.t
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,12 @@ EOXML
eval {
$doc2 = $parser->parse_string( $xmldoc );
};
isnt($@, '', "error parsing $xmldoc");
# https://gitlab.gnome.org/GNOME/libxml2/-/commit/b717abdd
if (XML::LibXML::LIBXML_RUNTIME_VERSION() < 21300) {
isnt($@, '', "error parsing $xmldoc");
} else {
is( $doc2->documentElement()->firstChild()->nodeName(), "foo" );
}

$parser->validation(1);

Expand Down
8 changes: 7 additions & 1 deletion t/08findnodes.t
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ my $docstring = q{
my @ns = $root->findnodes('namespace::*');
# TEST

is(scalar(@ns), 2, ' TODO : Add test name' );
# https://gitlab.gnome.org/GNOME/libxml2/-/commit/aca16fb3
# fixed xmlCopyNamespace with XML namespace.
if (XML::LibXML::LIBXML_RUNTIME_VERSION() < 21300) {
is(scalar(@ns), 2, ' TODO : Add test name' );
} else {
is(scalar(@ns), 3, ' TODO : Add test name' );
}

# bad xpaths
# TEST:$badxpath=4;
Expand Down
2 changes: 1 addition & 1 deletion t/19die_on_invalid_utf8_rt_58848.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use XML::LibXML;
my $err = $@;

# TEST
like ("$err", qr{parser error : Input is not proper UTF-8},
like ("$err", qr{not proper UTF-8|Invalid bytes in character encoding},
'Parser error.',
);
}
Expand Down
4 changes: 2 additions & 2 deletions t/25relaxng.t
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ print "# 6 check that no_network => 1 works\n";
{
my $rng = eval { XML::LibXML::RelaxNG->new( location => $netfile, no_network => 1 ) };
# TEST
like( $@, qr{I/O error : Attempt to load network entity}, 'RNG from file location with external import and no_network => 1 throws an exception.' );
like( $@, qr{Attempt to load network entity}, 'RNG from file location with external import and no_network => 1 throws an exception.' );
# TEST
ok( !defined $rng, 'RNG from file location with external import and no_network => 1 is not loaded.' );
}
Expand All @@ -152,7 +152,7 @@ print "# 6 check that no_network => 1 works\n";
</grammar>
EOF
# TEST
like( $@, qr{I/O error : Attempt to load network entity}, 'RNG from buffer with external import and no_network => 1 throws an exception.' );
like( $@, qr{Attempt to load network entity}, 'RNG from buffer with external import and no_network => 1 throws an exception.' );
# TEST
ok( !defined $rng, 'RNG from buffer with external import and no_network => 1 is not loaded.' );
}
Expand Down
4 changes: 2 additions & 2 deletions t/26schema.t
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ EOF
{
my $schema = eval { XML::LibXML::Schema->new( location => $netfile, no_network => 1 ) };
# TEST
like( $@, qr{I/O error : Attempt to load network entity}, 'Schema from file location with external import and no_network => 1 throws an exception.' );
like( $@, qr{Attempt to load network entity}, 'Schema from file location with external import and no_network => 1 throws an exception.' );
# TEST
ok( !defined $schema, 'Schema from file location with external import and no_network => 1 is not loaded.' );
}
Expand All @@ -129,7 +129,7 @@ EOF
</xsd:schema>
EOF
# TEST
like( $@, qr{I/O error : Attempt to load network entity}, 'Schema from buffer with external import and no_network => 1 throws an exception.' );
like( $@, qr{Attempt to load network entity}, 'Schema from buffer with external import and no_network => 1 throws an exception.' );
# TEST
ok( !defined $schema, 'Schema from buffer with external import and no_network => 1 is not loaded.' );
}
7 changes: 3 additions & 4 deletions t/60error_prev_chain.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ use XML::LibXML;

{
my $parser = XML::LibXML->new();
$parser->validation(0);
$parser->load_ext_dtd(0);

eval
{
local $^W = 0;
$parser->parse_file('example/JBR-ALLENtrees.htm');
$parser->parse_string('<doc>&ldquo;&nbsp;&rdquo;</doc>');
};

my $err = $@;
Expand All @@ -31,7 +29,7 @@ use XML::LibXML;
if( $err && !ref($err) ) {
plan skip_all => 'The local libxml library does not support errors as objects to $@';
}
plan tests => 1;
plan tests => 2;

while (defined($err) && $count < 200)
{
Expand All @@ -44,6 +42,7 @@ use XML::LibXML;

# TEST
ok ((!$err), "Reached the end of the chain.");
is ($count, 3, "Correct number of errors reported")
}

=head1 COPYRIGHT & LICENSE
Expand Down

0 comments on commit 482715a

Please sign in to comment.