File: 30keep_blanks.t

package info (click to toggle)
libxml-libxml-perl 2.0116%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 2,420 kB
  • sloc: perl: 6,139; ansic: 3,752; xml: 182; sh: 64; makefile: 8
file content (34 lines) | stat: -rw-r--r-- 701 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl

# This is a regression test for this bug:
#
# https://rt.cpan.org/Ticket/Display.html?id=76696
#
# <<<
# Specifying ->keep_blanks(0) has no effect on parse_balanced_chunk anymore.
# The script below used to pass with XML::LibXML 1.69, but is broken since
# 1.70 and also with the newest 1.96.
# >>>
#
# Thanks to SREZIC for the report, the test and a patch.

use strict;
use warnings;

use Test::More tests => 1;

use XML::LibXML;

my $xml = <<'EOF';
<bla> <foo/> </bla>
EOF

my $p = XML::LibXML->new;
$p->keep_blanks(0);

# TEST
is (
    scalar( $p->parse_balanced_chunk($xml)->serialize() ),
    "<bla><foo/></bla>\n",
    'keep_blanks(0) removes the blanks after a roundtrip.',
);