| 1 |
# This is a test for: |
| 2 |
# https://rt.cpan.org/Ticket/Display.html?id=106830 |
| 3 |
|
| 4 |
=head1 DESCRIPTION |
| 5 |
|
| 6 |
XML::LibXML::Reader emits a warning on empty string. |
| 7 |
|
| 8 |
=head1 THANKS. |
| 9 |
|
| 10 |
Rich. |
| 11 |
|
| 12 |
=cut |
| 13 |
|
| 14 |
use strict; |
| 15 |
use warnings; |
| 16 |
|
| 17 |
use Test::More tests => 2; |
| 18 |
|
| 19 |
use lib './t/lib'; |
| 20 |
use TestHelpers ( qw(eq_or_diff) ); |
| 21 |
|
| 22 |
use XML::LibXML::Reader; |
| 23 |
|
| 24 |
{ |
| 25 |
my @warnings; |
| 26 |
|
| 27 |
local $SIG{__WARN__} = sub { push @warnings, [@_] }; |
| 28 |
|
| 29 |
my $empty_xml_doc = ''; |
| 30 |
my $xml_reader = XML::LibXML::Reader->new(string => $empty_xml_doc); |
| 31 |
|
| 32 |
# TEST |
| 33 |
SKIP: |
| 34 |
{ |
| •35 |
if (XML::LibXML::LIBXML_RUNTIME_VERSION() >= 20905) |
| 36 |
{ |
| 37 |
skip 'libxml2 accepts empty strings since 2.9.5 version', 1; |
| 38 |
} |
| 39 |
ok (scalar(!defined($xml_reader)), 'xml_reader is undef', ); |
| 40 |
} |
| 41 |
|
| 42 |
# TEST |
| 43 |
eq_or_diff( |
| 44 |
\@warnings, |
| 45 |
[], |
| 46 |
'no warnigns were emitted.' |
| 47 |
); |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
=head1 COPYRIGHT & LICENSE |
| 52 |
|
| 53 |
Copyright 2015 by Shlomi Fish |
| 54 |
|
| 55 |
This program is distributed under the MIT (Expat) License: |
| 56 |
L<http://www.opensource.org/licenses/mit-license.php> |
| 57 |
|
| 58 |
Permission is hereby granted, free of charge, to any person |
| 59 |
obtaining a copy of this software and associated documentation |
| 60 |
files (the "Software"), to deal in the Software without |
| 61 |
restriction, including without limitation the rights to use, |
| 62 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 63 |
copies of the Software, and to permit persons to whom the |
| 64 |
Software is furnished to do so, subject to the following |
| 65 |
conditions: |
| 66 |
|
| 67 |
The above copyright notice and this permission notice shall be |
| 68 |
included in all copies or substantial portions of the Software. |
| 69 |
|
| 70 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 71 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 72 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 73 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 74 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 75 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 76 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 77 |
OTHER DEALINGS IN THE SOFTWARE. |
| 78 |
|
| 79 |
=cut |