Skip to content

Commit 482715a

Browse files
committed
Fix test suite with libxml2 2.13.0
1 parent 3c66d6d commit 482715a

File tree

6 files changed

+21
-11
lines changed

6 files changed

+21
-11
lines changed

t/02parse.t

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,12 @@ EOXML
884884
eval {
885885
$doc2 = $parser->parse_string( $xmldoc );
886886
};
887-
isnt($@, '', "error parsing $xmldoc");
887+
# https://gitlab.gnome.org/GNOME/libxml2/-/commit/b717abdd
888+
if (XML::LibXML::LIBXML_RUNTIME_VERSION() < 21300) {
889+
isnt($@, '', "error parsing $xmldoc");
890+
} else {
891+
is( $doc2->documentElement()->firstChild()->nodeName(), "foo" );
892+
}
888893

889894
$parser->validation(1);
890895

t/08findnodes.t

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,13 @@ my $docstring = q{
123123
my @ns = $root->findnodes('namespace::*');
124124
# TEST
125125

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

128134
# bad xpaths
129135
# TEST:$badxpath=4;

t/19die_on_invalid_utf8_rt_58848.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use XML::LibXML;
1616
my $err = $@;
1717

1818
# TEST
19-
like ("$err", qr{parser error : Input is not proper UTF-8},
19+
like ("$err", qr{not proper UTF-8|Invalid bytes in character encoding},
2020
'Parser error.',
2121
);
2222
}

t/25relaxng.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ print "# 6 check that no_network => 1 works\n";
132132
{
133133
my $rng = eval { XML::LibXML::RelaxNG->new( location => $netfile, no_network => 1 ) };
134134
# TEST
135-
like( $@, qr{I/O error : Attempt to load network entity}, 'RNG from file location with external import and no_network => 1 throws an exception.' );
135+
like( $@, qr{Attempt to load network entity}, 'RNG from file location with external import and no_network => 1 throws an exception.' );
136136
# TEST
137137
ok( !defined $rng, 'RNG from file location with external import and no_network => 1 is not loaded.' );
138138
}
@@ -152,7 +152,7 @@ print "# 6 check that no_network => 1 works\n";
152152
</grammar>
153153
EOF
154154
# TEST
155-
like( $@, qr{I/O error : Attempt to load network entity}, 'RNG from buffer with external import and no_network => 1 throws an exception.' );
155+
like( $@, qr{Attempt to load network entity}, 'RNG from buffer with external import and no_network => 1 throws an exception.' );
156156
# TEST
157157
ok( !defined $rng, 'RNG from buffer with external import and no_network => 1 is not loaded.' );
158158
}

t/26schema.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ EOF
117117
{
118118
my $schema = eval { XML::LibXML::Schema->new( location => $netfile, no_network => 1 ) };
119119
# TEST
120-
like( $@, qr{I/O error : Attempt to load network entity}, 'Schema from file location with external import and no_network => 1 throws an exception.' );
120+
like( $@, qr{Attempt to load network entity}, 'Schema from file location with external import and no_network => 1 throws an exception.' );
121121
# TEST
122122
ok( !defined $schema, 'Schema from file location with external import and no_network => 1 is not loaded.' );
123123
}
@@ -129,7 +129,7 @@ EOF
129129
</xsd:schema>
130130
EOF
131131
# TEST
132-
like( $@, qr{I/O error : Attempt to load network entity}, 'Schema from buffer with external import and no_network => 1 throws an exception.' );
132+
like( $@, qr{Attempt to load network entity}, 'Schema from buffer with external import and no_network => 1 throws an exception.' );
133133
# TEST
134134
ok( !defined $schema, 'Schema from buffer with external import and no_network => 1 is not loaded.' );
135135
}

t/60error_prev_chain.t

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ use XML::LibXML;
1616

1717
{
1818
my $parser = XML::LibXML->new();
19-
$parser->validation(0);
20-
$parser->load_ext_dtd(0);
2119

2220
eval
2321
{
2422
local $^W = 0;
25-
$parser->parse_file('example/JBR-ALLENtrees.htm');
23+
$parser->parse_string('<doc>&ldquo;&nbsp;&rdquo;</doc>');
2624
};
2725

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

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

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

4948
=head1 COPYRIGHT & LICENSE

0 commit comments

Comments
 (0)