1 From bee8338fd1cbd7aad4bf60c2965833343b6ead6f Mon Sep 17 00:00:00 2001
2 From: Nick Wellnhofer <wellnhofer@aevum.de>
3 Date: Tue, 21 May 2024 15:17:30 +0200
4 Subject: [PATCH] Fix test suite with libxml2 2.13.0
7 t/02parse.t | 7 ++++++-
8 t/08findnodes.t | 8 +++++++-
9 t/19die_on_invalid_utf8_rt_58848.t | 2 +-
10 t/25relaxng.t | 4 ++--
12 t/60error_prev_chain.t | 8 ++++----
13 6 files changed, 22 insertions(+), 11 deletions(-)
15 diff --git a/t/02parse.t b/t/02parse.t
16 index b111507b..40aa5f13 100644
19 @@ -884,7 +884,12 @@ EOXML
21 $doc2 = $parser->parse_string( $xmldoc );
23 - isnt($@, '', "error parsing $xmldoc");
24 + # https://gitlab.gnome.org/GNOME/libxml2/-/commit/b717abdd
25 + if (XML::LibXML::LIBXML_RUNTIME_VERSION() < 21300) {
26 + isnt($@, '', "error parsing $xmldoc");
28 + is( $doc2->documentElement()->firstChild()->nodeName(), "foo" );
31 $parser->validation(1);
33 diff --git a/t/08findnodes.t b/t/08findnodes.t
34 index 016c85a1..e9417bc5 100644
37 @@ -123,7 +123,13 @@ my $docstring = q{
38 my @ns = $root->findnodes('namespace::*');
41 -is(scalar(@ns), 2, ' TODO : Add test name' );
42 +# https://gitlab.gnome.org/GNOME/libxml2/-/commit/aca16fb3
43 +# fixed xmlCopyNamespace with XML namespace.
44 +if (XML::LibXML::LIBXML_RUNTIME_VERSION() < 21300) {
45 + is(scalar(@ns), 2, ' TODO : Add test name' );
47 + is(scalar(@ns), 3, ' TODO : Add test name' );
52 diff --git a/t/19die_on_invalid_utf8_rt_58848.t b/t/19die_on_invalid_utf8_rt_58848.t
53 index aa8ad105..4160cb27 100644
54 --- a/t/19die_on_invalid_utf8_rt_58848.t
55 +++ b/t/19die_on_invalid_utf8_rt_58848.t
56 @@ -16,7 +16,7 @@ use XML::LibXML;
60 - like ("$err", qr{parser error : Input is not proper UTF-8},
61 + like ("$err", qr{not proper UTF-8|Invalid bytes in character encoding},
65 diff --git a/t/25relaxng.t b/t/25relaxng.t
66 index 93e61883..71383b2a 100644
69 @@ -132,7 +132,7 @@ print "# 6 check that no_network => 1 works\n";
71 my $rng = eval { XML::LibXML::RelaxNG->new( location => $netfile, no_network => 1 ) };
73 - like( $@, qr{I/O error : Attempt to load network entity}, 'RNG from file location with external import and no_network => 1 throws an exception.' );
74 + like( $@, qr{Attempt to load network entity}, 'RNG from file location with external import and no_network => 1 throws an exception.' );
76 ok( !defined $rng, 'RNG from file location with external import and no_network => 1 is not loaded.' );
78 @@ -152,7 +152,7 @@ print "# 6 check that no_network => 1 works\n";
82 - like( $@, qr{I/O error : Attempt to load network entity}, 'RNG from buffer with external import and no_network => 1 throws an exception.' );
83 + like( $@, qr{Attempt to load network entity}, 'RNG from buffer with external import and no_network => 1 throws an exception.' );
85 ok( !defined $rng, 'RNG from buffer with external import and no_network => 1 is not loaded.' );
87 diff --git a/t/26schema.t b/t/26schema.t
88 index 17f641e4..c404cedd 100644
91 @@ -117,7 +117,7 @@ EOF
93 my $schema = eval { XML::LibXML::Schema->new( location => $netfile, no_network => 1 ) };
95 - like( $@, qr{I/O error : Attempt to load network entity}, 'Schema from file location with external import and no_network => 1 throws an exception.' );
96 + like( $@, qr{Attempt to load network entity}, 'Schema from file location with external import and no_network => 1 throws an exception.' );
98 ok( !defined $schema, 'Schema from file location with external import and no_network => 1 is not loaded.' );
100 @@ -129,7 +129,7 @@ EOF
104 - like( $@, qr{I/O error : Attempt to load network entity}, 'Schema from buffer with external import and no_network => 1 throws an exception.' );
105 + like( $@, qr{Attempt to load network entity}, 'Schema from buffer with external import and no_network => 1 throws an exception.' );
107 ok( !defined $schema, 'Schema from buffer with external import and no_network => 1 is not loaded.' );
109 diff --git a/t/60error_prev_chain.t b/t/60error_prev_chain.t
110 index e48215c4..55ac0b2e 100644
111 --- a/t/60error_prev_chain.t
112 +++ b/t/60error_prev_chain.t
113 @@ -16,13 +16,11 @@ use XML::LibXML;
116 my $parser = XML::LibXML->new();
117 - $parser->validation(0);
118 - $parser->load_ext_dtd(0);
123 - $parser->parse_file('example/JBR-ALLENtrees.htm');
124 + $parser->parse_string('<doc>“ ”</doc>');
128 @@ -31,7 +29,7 @@ use XML::LibXML;
129 if( $err && !ref($err) ) {
130 plan skip_all => 'The local libxml library does not support errors as objects to $@';
135 while (defined($err) && $count < 200)
137 @@ -44,6 +42,8 @@ use XML::LibXML;
140 ok ((!$err), "Reached the end of the chain.");
142 + is ($count, 3, "Correct number of errors reported")
145 =head1 COPYRIGHT & LICENSE