Add probes for LOCALTIME_max and LOCALTIME_min (y2038 project)
[p5sagit/p5-mst-13.2.git] / lib / Pod / t / man-options.t
CommitLineData
55595e83 1#!/usr/bin/perl -w
2#
3# man-options.t -- Additional tests for Pod::Man options.
4#
5# Copyright 2002, 2004, 2006, 2008 Russ Allbery <rra@stanford.edu>
6#
7# This program is free software; you may redistribute it and/or modify it
8# under the same terms as Perl itself.
9
10BEGIN {
11 chdir 't' if -d 't';
12 if ($ENV{PERL_CORE}) {
13 @INC = '../lib';
14 } else {
15 unshift (@INC, '../blib/lib');
16 }
17 unshift (@INC, '../blib/lib');
18 $| = 1;
0e4e3f6e 19 print "1..7\n";
55595e83 20}
21
22END {
23 print "not ok 1\n" unless $loaded;
24}
25
26use Pod::Man;
27
28$loaded = 1;
29print "ok 1\n";
30
31my $n = 2;
32while (<DATA>) {
33 my %options;
34 next until $_ eq "###\n";
35 while (<DATA>) {
36 last if $_ eq "###\n";
37 my ($option, $value) = split;
38 $options{$option} = $value;
39 }
40 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
41 while (<DATA>) {
42 last if $_ eq "###\n";
43 print TMP $_;
44 }
45 close TMP;
46 my $parser = Pod::Man->new (%options) or die "Cannot create parser\n";
47 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
48 $parser->parse_from_file ('tmp.pod', \*OUT);
49 close OUT;
0e4e3f6e 50 my $accents = 0;
55595e83 51 open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
0e4e3f6e 52 while (<TMP>) {
53 $accents = 1 if /Accent mark definitions/;
54 last if /^\.nh/;
55 }
55595e83 56 my $output;
57 {
58 local $/;
59 $output = <TMP>;
60 }
61 close TMP;
62 unlink ('tmp.pod', 'out.tmp');
0e4e3f6e 63 if (($options{utf8} && !$accents) || (!$options{utf8} && $accents)) {
64 print "ok $n\n";
65 } else {
66 print "not ok $n\n";
67 print ($accents ? "Saw accents\n" : "Saw no accents\n");
68 print ($options{utf8} ? "Wanted no accents\n" : "Wanted accents\n");
69 }
70 $n++;
55595e83 71 my $expected = '';
72 while (<DATA>) {
73 last if $_ eq "###\n";
74 $expected .= $_;
75 }
76 if ($output eq $expected) {
77 print "ok $n\n";
78 } else {
79 print "not ok $n\n";
80 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
81 }
82 $n++;
83}
84
85# Below the marker are bits of POD and corresponding expected text output.
86# This is used to test specific features or problems with Pod::Man. The
87# input and output are separated by lines containing only ###.
88
89__DATA__
90
91###
92utf8 1
93###
94=head1 BEYONCÉ
95
96Beyoncé! Beyoncé! Beyoncé!!
97
98 Beyoncé! Beyoncé!
99 Beyoncé! Beyoncé!
100 Beyoncé! Beyoncé!
101
102Older versions did not convert Beyoncé in verbatim.
103###
104.SH "BEYONCÉ"
105.IX Header "BEYONCÉ"
106Beyoncé! Beyoncé! Beyoncé!!
107.PP
108.Vb 3
109\& Beyoncé! Beyoncé!
110\& Beyoncé! Beyoncé!
111\& Beyoncé! Beyoncé!
112.Ve
113.PP
114Older versions did not convert Beyoncé in verbatim.
115###
0e4e3f6e 116
117###
118utf8 1
119###
120=head1 SE<lt>E<gt> output with UTF-8
121
122This is S<non-breaking output>.
123###
124.SH "S<> output with UTF\-8"
125.IX Header "S<> output with UTF-8"
126This is non\-breaking output.
127###
128
129###
130fixed CR
131fixedbold CY
132fixeditalic CW
133fixedbolditalic CX
134###
135=head1 FIXED FONTS
136
137C<foo B<bar I<baz>> I<bay>>
138###
139.SH "FIXED FONTS"
140.IX Header "FIXED FONTS"
141\&\f(CR\*(C`foo \f(CYbar \f(CXbaz\f(CY\f(CR \f(CWbay\f(CR\*(C'\fR
142###