2 # $Id: man.t,v 1.10 2006-09-16 20:25:25 eagle Exp $
4 # man.t -- Additional specialized tests for Pod::Man.
6 # Copyright 2002, 2003, 2004, 2006 by Russ Allbery <rra@stanford.edu>
8 # This program is free software; you may redistribute it and/or modify it
9 # under the same terms as Perl itself.
13 if ($ENV{PERL_CORE}) {
16 unshift (@INC, '../blib/lib');
18 unshift (@INC, '../blib/lib');
24 print "not ok 1\n" unless $loaded;
32 my $have_encoding = eval { require PerlIO::encoding; 1; } && ! $@;
34 my $parser = Pod::Man->new or die "Cannot create parser\n";
37 next until $_ eq "###\n";
38 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
40 # We have a test in ISO 8859-1 encoding. Make sure that nothing strange
41 # happens if Perl thinks the world is Unicode.
42 binmode (\*TMP, ':encoding(iso-8859-1)') if $have_encoding;
45 last if $_ eq "###\n";
50 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
51 $parser->parse_from_file ('tmp.pod', \*OUT);
53 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
54 while (<OUT>) { last if /^\.nh/ }
61 unlink ('tmp.pod', 'out.tmp');
64 last if $_ eq "###\n";
67 if ($output eq $expected) {
71 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
76 # Below the marker are bits of POD and corresponding expected nroff output.
77 # This is used to test specific features or problems with Pod::Man. The input
78 # and output are separated by lines containing only ###.
85 gcc - GNU project C and C++ compiler
89 Other mentions of C++.
92 gcc \- GNU project C and C++ compiler
95 Other mentions of \*(C+.
101 This C<.> should be quoted.
105 This \f(CW\*(C`.\*(C'\fR should be quoted.
119 =item * Also a bullet.
156 Beyoncé! Beyoncé! Beyoncé!!
162 Older versions didn't convert Beyoncé in verbatim.
166 Beyonce\*'! Beyonce\*'! Beyonce\*'!!
169 \& Beyonce\*'! Beyonce\*'!
170 \& Beyonce\*'! Beyonce\*'!
171 \& Beyonce\*'! Beyonce\*'!
174 Older versions didn't convert Beyonce\*' in verbatim.
180 =item 1. Not a number
182 =item 2. Spaced right
194 .IP "1. Not a number" 4
195 .IX Item "1. Not a number"
197 .IP "2. Spaced right" 4
198 .IX Item "2. Spaced right"
199 .IP "1 Not a number" 2
200 .IX Item "1 Not a number"
201 .IP "2 Spaced right" 2
202 .IX Item "2 Spaced right"
225 The quotes should be converted in the above to paired quotes.
229 \&\*(L"=over ... =back\*(R"
233 The quotes should be converted in the above to paired quotes.
239 It cost me E<165>12345! That should be an X.
243 It cost me X12345! That should be an X.
249 Open E<agrave> la shell. Previous versions mapped it wrong.
253 Open a\*` la shell. Previous versions mapped it wrong.
274 .IX Item "First level"
287 =item 1. Check fonts in @CARP_NOT test.
291 .ie n .IP "1. Check fonts in @CARP_NOT test." 4
292 .el .IP "1. Check fonts in \f(CW@CARP_NOT\fR test." 4
293 .IX Item "1. Check fonts in @CARP_NOT test."
299 There should not be double quotes: L<C<< (?>pattern) >>>.
302 .IX Header "LINK QUOTING"
303 There should not be double quotes: \f(CW\*(C`(?>pattern)\*(C'\fR.
307 =head1 SE<lt>E<gt> MAGIC
309 Magic should be applied S<RISC OS> to that.
312 .IX Header "S<> MAGIC"
313 Magic should be applied \s-1RISC\s0\ \s-1OS\s0 to that.
319 These should be identical.
321 Bippity boppity boo "The
324 Bippity boppity boo "The
328 .IX Header "MAGIC MONEY"
329 These should be identical.
331 Bippity boppity boo \*(L"The
332 price is \f(CW$100\fR.\*(R"
334 Bippity boppity boo \*(L"The
335 price is \f(CW$100\fR.\*(R"
341 "Stuff" (no guesswork)
345 Oboy, is this C++ "fun" yet! (guesswork)
348 "Stuff" (no guesswork)
350 .IX Subsection "THINGS"
351 Oboy, is this \*(C+ \*(L"fun\*(R" yet! (guesswork)
355 =head1 Newline C Quote Weirdness
360 .SH "Newline C Quote Weirdness"
361 .IX Header "Newline C Quote Weirdness"
367 =head1 Soft Hypen Testing
371 JarkE<shy>ko HieE<shy>taE<shy>nieE<shy>mi
377 JarkE<173>ko HieE<173>taE<173>nieE<173>mi
383 JarkE<0x00AD>ko HieE<0x00AD>taE<0x00AD>nieE<0x00AD>mi
385 .SH "Soft Hypen Testing"
386 .IX Header "Soft Hypen Testing"
389 Jark\%ko Hie\%ta\%nie\%mi
395 Jark\%ko Hie\%ta\%nie\%mi
401 Jark\%ko Hie\%ta\%nie\%mi
405 =head1 XE<lt>E<gt> Whitespace
407 Blorpy L<B<prok>|blap> X<bivav> wugga chachacha.
410 .IX Header "X<> Whitespace"
411 Blorpy \fBprok\fR wugga chachacha.
416 =head1 Hyphen in SE<lt>E<gt>
418 Don't S<transform even-this hyphen>. This "one's-fine!", as well. However,
419 $-0.13 should have a real hyphen.
422 .IX Header "Hyphen in S<>"
423 Don't transform\ even-this\ hyphen. This \*(L"one's-fine!\*(R", as well. However,
424 $\-0.13 should have a real hyphen.