3 # man-options.t -- Additional tests for Pod::Man options.
5 # Copyright 2002, 2004, 2006, 2008 Russ Allbery <rra@stanford.edu>
7 # This program is free software; you may redistribute it and/or modify it
8 # under the same terms as Perl itself.
12 if ($ENV{PERL_CORE}) {
15 unshift (@INC, '../blib/lib');
17 unshift (@INC, '../blib/lib');
21 # UTF-8 support requires Perl 5.8 or later.
25 print "ok $n # skip -- Perl 5.8 required for UTF-8 support\n";
32 print "not ok 1\n" unless $loaded;
41 eval { binmode (\*DATA, ':encoding(utf-8)') };
44 next until $_ eq "###\n";
46 last if $_ eq "###\n";
47 my ($option, $value) = split;
48 $options{$option} = $value;
50 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
51 eval { binmode (\*TMP, ':encoding(utf-8)') };
52 print TMP "=encoding utf-8\n\n";
54 last if $_ eq "###\n";
58 my $parser = Pod::Man->new (%options) or die "Cannot create parser\n";
59 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
60 eval { binmode (\*OUT, ':encoding(utf-8)') };
61 $parser->parse_from_file ('tmp.pod', \*OUT);
64 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
65 eval { binmode (\*TMP, ':encoding(utf-8)') };
67 $accents = 1 if /Accent mark definitions/;
76 unlink ('tmp.pod', 'out.tmp');
77 if (($options{utf8} && !$accents) || (!$options{utf8} && $accents)) {
81 print ($accents ? "Saw accents\n" : "Saw no accents\n");
82 print ($options{utf8} ? "Wanted no accents\n" : "Wanted accents\n");
87 last if $_ eq "###\n";
90 if ($output eq $expected) {
94 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
99 # Below the marker are bits of POD and corresponding expected text output.
100 # This is used to test specific features or problems with Pod::Man. The
101 # input and output are separated by lines containing only ###.
110 Beyoncé! Beyoncé! Beyoncé!!
116 Older versions did not convert Beyoncé in verbatim.
120 Beyoncé! Beyoncé! Beyoncé!!
128 Older versions did not convert Beyoncé in verbatim.
134 =head1 SE<lt>E<gt> output with UTF-8
136 This is S<non-breaking output>.
138 .SH "S<> output with UTF\-8"
139 .IX Header "S<> output with UTF-8"
140 This is non-breaking output.