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