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