Upgrade to podlators-2.00
[p5sagit/p5-mst-13.2.git] / lib / Pod / t / man.t
CommitLineData
2da3dd12 1#!/usr/bin/perl -w
b7ae008f 2# $Id: man.t,v 1.5 2004/02/15 06:42:49 eagle Exp $
2da3dd12 3#
4# man.t -- Additional specialized tests for Pod::Man.
5#
b7ae008f 6# Copyright 2002, 2003, 2004 by Russ Allbery <rra@stanford.edu>
2da3dd12 7#
8# This program is free software; you may redistribute it and/or modify it
9# under the same terms as Perl itself.
10
11BEGIN {
12 chdir 't' if -d 't';
13 if ($ENV{PERL_CORE}) {
14 @INC = '../lib';
15 } else {
16 unshift (@INC, '../blib/lib');
17 }
18 unshift (@INC, '../blib/lib');
19 $| = 1;
b7ae008f 20 print "1..21\n";
2da3dd12 21}
22
23END {
24 print "not ok 1\n" unless $loaded;
25}
26
27use Pod::Man;
28
29$loaded = 1;
30print "ok 1\n";
31
32my $n = 2;
33while (<DATA>) {
34 next until $_ eq "###\n";
35 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
36 while (<DATA>) {
37 last if $_ eq "###\n";
38 print TMP $_;
39 }
40 close TMP;
41 my $parser = Pod::Man->new or die "Cannot create parser\n";
42 $parser->parse_from_file ('tmp.pod', 'out.tmp');
b7ae008f 43 undef $parser;
44 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
45 while (<OUT>) { last if /^\.TH/ }
2da3dd12 46 my $output;
47 {
48 local $/;
b7ae008f 49 $output = <OUT>;
2da3dd12 50 }
b7ae008f 51 close OUT;
2da3dd12 52 unlink ('tmp.pod', 'out.tmp');
53 my $expected = '';
54 while (<DATA>) {
55 last if $_ eq "###\n";
56 $expected .= $_;
57 }
58 if ($output eq $expected) {
59 print "ok $n\n";
60 } else {
61 print "not ok $n\n";
62 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
63 }
64 $n++;
65}
66
67# Below the marker are bits of POD and corresponding expected nroff output.
68# This is used to test specific features or problems with Pod::Man. The input
69# and output are separated by lines containing only ###.
70
71__DATA__
72
73###
74=head1 NAME
75
76gcc - GNU project C and C++ compiler
77
78=head1 C++ NOTES
79
80Other mentions of C++.
81###
82.SH "NAME"
83gcc \- GNU project C and C++ compiler
84.SH "\*(C+ NOTES"
85.IX Header " NOTES"
86Other mentions of \*(C+.
87###
f011ec7d 88
89###
90=head1 PERIODS
91
92This C<.> should be quoted.
93###
94.SH "PERIODS"
95.IX Header "PERIODS"
96This \f(CW\*(C`.\*(C'\fR should be quoted.
97###
4213be12 98
99###
100=over 4
101
102=item *
103
104A bullet.
105
106=item *
107
108Another bullet.
109
b7ae008f 110=item * Also a bullet.
4213be12 111
112=back
113###
114.IP "\(bu" 4
115A bullet.
116.IP "\(bu" 4
117Another bullet.
b7ae008f 118.IP "\(bu" 4
119Also a bullet.
4213be12 120###
121
122###
123=over 4
124
125=item foo
126
127Not a bullet.
128
129=item *
130
131Also not a bullet.
132
133=back
134###
135.IP "foo" 4
136.IX Item "foo"
137Not a bullet.
138.IP "*" 4
139Also not a bullet.
140###
b7ae008f 141
142###
143=head1 ACCENTS
144
145Beyoncé! Beyoncé! Beyoncé!!
146
147 Beyoncé! Beyoncé!
148 Beyoncé! Beyoncé!
149 Beyoncé! Beyoncé!
150
151Older versions didn't convert Beyoncé in verbatim.
152###
153.SH "ACCENTS"
154.IX Header "ACCENTS"
155Beyonce\*'! Beyonce\*'! Beyonce\*'!!
156.PP
157.Vb 3
158\& Beyonce\*'! Beyonce\*'!
159\& Beyonce\*'! Beyonce\*'!
160\& Beyonce\*'! Beyonce\*'!
161.Ve
162.PP
163Older versions didn't convert Beyonce\*' in verbatim.
164###
165
166###
167=over 4
168
169=item 1. Not a number
170
171=item 2. Spaced right
172
173=back
174
175=over 2
176
177=item 1 Not a number
178
179=item 2 Spaced right
180
181=back
182###
183.IP "1. Not a number" 4
184.IX Item "1. Not a number"
185.PD 0
186.IP "2. Spaced right" 4
187.IX Item "2. Spaced right"
188.IP "1 Not a number" 2
189.IX Item "1 Not a number"
190.IP "2 Spaced right" 2
191.IX Item "2 Spaced right"
192###
193
194###
195=over 4
196
197=item Z<>*
198
199Not bullet.
200
201=back
202###
203.IP "*" 4
204Not bullet.
205###
206
207###
208=head1 SEQS
209
210"=over ... Z<>=back"
211
212"SE<lt>...E<gt>"
213
214The quotes should be converted in the above to paired quotes.
215###
216.SH "SEQS"
217.IX Header "SEQS"
218\&\*(L"=over ... =back\*(R"
219.PP
220\&\*(L"S<...>\*(R"
221.PP
222The quotes should be converted in the above to paired quotes.
223###
224
225###
226=head1 YEN
227
228It cost me E<165>12345! That should be an X.
229###
230.SH "YEN"
231.IX Header "YEN"
232It cost me X12345! That should be an X.
233###
234
235###
236=head1 agrave
237
238Open E<agrave> la shell. Previous versions mapped it wrong.
239###
240.SH "agrave"
241.IX Header "agrave"
242Open a\*` la shell. Previous versions mapped it wrong.
243###
244
245###
246=over
247
248=item First level
249
250Blah blah blah....
251
252=over
253
254=item *
255
256Should be a bullet.
257
258=back
259
260=back
261###
262.IP "First level" 4
263.IX Item "First level"
264Blah blah blah....
265.RS 4
266.IP "\(bu" 4
267Should be a bullet.
268.RE
269.RS 4
270.RE
271###
272
273###
274=over 4
275
276=item 1. Check fonts in @CARP_NOT test.
277
278=back
279###
280.ie n .IP "1. Check fonts in @CARP_NOT test." 4
281.el .IP "1. Check fonts in \f(CW@CARP_NOT\fR test." 4
282.IX Item "1. Check fonts in @CARP_NOT test."
283###
284
285###
286=head1 LINK QUOTING
287
288There should not be double quotes: L<C<< (?>pattern) >>>.
289###
290.SH "LINK QUOTING"
291.IX Header "LINK QUOTING"
292There should not be double quotes: \f(CW\*(C`(?>pattern)\*(C'\fR.
293###
294
295###
296=head1 SE<lt>E<gt> MAGIC
297
298Magic should be applied S<RISC OS> to that.
299###
300.SH "S<> MAGIC"
301.IX Header "S<> MAGIC"
302Magic should be applied \s-1RISC\s0\ \s-1OS\s0 to that.
303###
304
305###
306=head1 MAGIC MONEY
307
308These should be identical.
309
310Bippity boppity boo "The
311price is $Z<>100."
312
313Bippity boppity boo "The
314price is $100."
315###
316.SH "MAGIC MONEY"
317.IX Header "MAGIC MONEY"
318These should be identical.
319.PP
320Bippity boppity boo \*(L"The
321price is \f(CW$100\fR.\*(R"
322.PP
323Bippity boppity boo \*(L"The
324price is \f(CW$100\fR.\*(R"
325###
326
327###
328=head1 NAME
329
330"Stuff" (no guesswork)
331
332=head2 THINGS
333
334Oboy, is this C++ "fun" yet! (guesswork)
335###
336.SH "NAME"
337"Stuff" (no guesswork)
338.Sh "\s-1THINGS\s0"
339.IX Subsection "THINGS"
340Oboy, is this \*(C+ \*(L"fun\*(R" yet! (guesswork)
341###
342
343###
344=head1 Newline C Quote Weirdness
345
346Blorp C<'
347''>. Yes.
348###
349.SH "Newline C Quote Weirdness"
350.IX Header "Newline C Quote Weirdness"
351Blorp \f(CW'
352\&''\fR. Yes.
353###
354
355###
356=head1 Soft Hypen Testing
357
358sigE<shy>action
359manuE<shy>script
360JarkE<shy>ko HieE<shy>taE<shy>nieE<shy>mi
361
362And again:
363
364sigE<173>action
365manuE<173>script
366JarkE<173>ko HieE<173>taE<173>nieE<173>mi
367
368And one more time:
369
370sigE<0x00AD>action
371manuE<0x00AD>script
372JarkE<0x00AD>ko HieE<0x00AD>taE<0x00AD>nieE<0x00AD>mi
373###
374.SH "Soft Hypen Testing"
375.IX Header "Soft Hypen Testing"
376sig\%action
377manu\%script
378Jark\%ko Hie\%ta\%nie\%mi
379.PP
380And again:
381.PP
382sig\%action
383manu\%script
384Jark\%ko Hie\%ta\%nie\%mi
385.PP
386And one more time:
387.PP
388sig\%action
389manu\%script
390Jark\%ko Hie\%ta\%nie\%mi
391###
392
393###
394=head1 XE<lt>E<gt> Whitespace
395
396Blorpy L<B<prok>|blap> X<bivav> wugga chachacha.
397###
398.SH "X<> Whitespace"
399.IX Header "X<> Whitespace"
400Blorpy \fBprok\fR wugga chachacha.
401.IX Xref "bivav"
402###
403
404###
405=head1 Hyphen in SE<lt>E<gt>
406
407Don't S<transform even-this hyphen>.
408###
409.SH "Hyphen in S<>"
410.IX Header "Hyphen in S<>"
411Don't transform\ even-this\ hyphen.
412###