xref: /openbsd-src/gnu/usr.bin/perl/cpan/Pod-Simple/t/items02.t (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1# Testing the =item directive
2BEGIN {
3    if($ENV{PERL_CORE}) {
4        chdir 't';
5        @INC = '../lib';
6    }
7}
8
9use strict;
10use Test;
11BEGIN { plan tests => 4 };
12
13my $d;
14#use Pod::Simple::Debug (\$d,0);
15
16ok 1;
17
18use Pod::Simple::DumpAsXML;
19use Pod::Simple::XMLOutStream;
20print "# Pod::Simple version $Pod::Simple::VERSION\n";
21sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) }
22
23my $x = 'Pod::Simple::XMLOutStream';
24
25print "##### Tests for =item directives via class $x\n";
26
27$Pod::Simple::XMLOutStream::ATTR_PAD   = ' ';
28$Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output
29
30
31print "#\n# Tests for =item [number] that are icky...\n";
32ok( $x->_out(sub { $_[0]->no_errata_section(1) },
33  "\n=over\n\n=item 5\n\nStuff\n\n=cut\n\nCrunk\nZorp\n\n=item 4\n\nQuux\n\n=back\n\n"),
34    '<Document><over-text indent="4"><item-text>5</item-text><Para>Stuff</Para><item-text>4</item-text><Para>Quux</Para></over-text></Document>'
35);
36
37ok( $x->_out(sub { $_[0]->no_errata_section(1) },
38  "\n=over\n\n=item 5.\n\nStuff\n\n=cut\n\nCrunk\nZorp\n\n=item 4.\n\nQuux\n\n=back\n\n"),
39    '<Document><over-text indent="4"><item-text>5.</item-text><Para>Stuff</Para><item-text>4.</item-text><Para>Quux</Para></over-text></Document>'
40);
41
42
43print "# Wrapping up... one for the road...\n";
44ok 1;
45print "# --- Done with ", __FILE__, " --- \n";
46
47