Debian Codegraph @

t/30keep_blanks.t

raw
1 #!/usr/bin/perl
2
3 # This is a regression test for this bug:
4 #
5 # https://rt.cpan.org/Ticket/Display.html?id=76696
6 #
7 # <<<
8 # Specifying ->keep_blanks(0) has no effect on parse_balanced_chunk anymore.
9 # The script below used to pass with XML::LibXML 1.69, but is broken since
10 # 1.70 and also with the newest 1.96.
11 # >>>
12 #
13 # Thanks to SREZIC for the report, the test and a patch.
14
15 use strict;
16 use warnings;
17
18 use Test::More tests => 1;
19
20 use XML::LibXML;
21
22 my $xml = <<'EOF';
23 <bla> <foo/> </bla>
24 EOF
25
26 my $p = XML::LibXML->new;
27 $p->keep_blanks(0);
28
29 # TEST
30 is (
31 scalar( $p->parse_balanced_chunk($xml)->serialize() ),
32 "<bla><foo/></bla>\n",
33 'keep_blanks(0) removes the blanks after a roundtrip.',
34 );