xref: /openbsd-src/gnu/usr.bin/perl/cpan/Pod-Simple/t/emptylists.t (revision 5486feefcc8cb79b19e014ab332cc5dfd05b3b33)
1898184e3Ssthenuse strict;
2256a93a4Safresh1use warnings;
3*5486feefSafresh1use Test::More tests => 3;
4898184e3Ssthen
5898184e3Ssthenuse Pod::Simple::XMLOutStream;
6898184e3Ssthenprint "# Pod::Simple version $Pod::Simple::VERSION\n";
7898184e3Ssthen
8898184e3Ssthenmy $x = 'Pod::Simple::XMLOutStream';
9898184e3Ssthen$Pod::Simple::XMLOutStream::ATTR_PAD   = ' ';
10898184e3Ssthen$Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output
11898184e3Ssthen
12898184e3Ssthensub on {shift->parse_empty_lists(1)}
13898184e3Ssthensub off {shift->parse_empty_lists(0)}
14898184e3Ssthen
15898184e3Ssthenmy $pod = <<POD;
16898184e3Ssthen=over
17898184e3Ssthen
18898184e3Ssthen=over
19898184e3Ssthen
20898184e3Ssthen=over
21898184e3Ssthen
22898184e3Ssthen=over
23898184e3Ssthen
24898184e3Ssthen=back
25898184e3Ssthen
26898184e3Ssthen=over
27898184e3Ssthen
28898184e3Ssthen=back
29898184e3Ssthen
30898184e3Ssthen=back
31898184e3Ssthen
32898184e3Ssthen=back
33898184e3Ssthen
34898184e3Ssthen=back
35898184e3SsthenPOD
36898184e3Ssthen
37898184e3Ssthen#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38898184e3Ssthen
39898184e3Ssthenprint "# Testing default behavior (parse_empty_lists( FALSE )) ...\n";
40898184e3Ssthen
41*5486feefSafresh1is( $x->_out($pod),
42898184e3Ssthen  '<Document><over-block indent="4"><over-block indent="4"><over-block indent="4"></over-block></over-block></over-block></Document>'
43898184e3Ssthen);
44898184e3Ssthen
45898184e3Ssthenprint "# Testing explicit parse_empty_lists( FALSE ) ...\n";
46898184e3Ssthen
47*5486feefSafresh1is( $x->_out(\&off, $pod),
48898184e3Ssthen  '<Document><over-block indent="4"><over-block indent="4"><over-block indent="4"></over-block></over-block></over-block></Document>'
49898184e3Ssthen);
50898184e3Ssthen
51898184e3Ssthenprint "# Testing parse_empty_lists( TRUE ) ...\n";
52898184e3Ssthen
53*5486feefSafresh1is( $x->_out(\&on, $pod),
54898184e3Ssthen  '<Document><over-block indent="4"><over-block indent="4"><over-block indent="4"><over-empty indent="4"></over-empty><over-empty indent="4"></over-empty></over-block></over-block></over-block></Document>'
55898184e3Ssthen);
56