2 # $Id: man.t,v 1.8 2006-01-25 23:58:22 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 $parser = Pod::Man->new or die "Cannot create parser\n";
35 next until $_ eq "###\n";
36 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
38 # We have a test in ISO 8859-1 encoding. Make sure that nothing strange
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)') };
44 last if $_ eq "###\n";
48 $parser->parse_from_file ('tmp.pod', 'out.tmp');
49 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
50 while (<OUT>) { last if /^\.TH/ }
57 unlink ('tmp.pod', 'out.tmp');
60 last if $_ eq "###\n";
63 if ($output eq $expected) {
67 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
72 # Below the marker are bits of POD and corresponding expected nroff output.
73 # This is used to test specific features or problems with Pod::Man. The input
74 # and output are separated by lines containing only ###.
81 gcc - GNU project C and C++ compiler
85 Other mentions of C++.
88 gcc \- GNU project C and C++ compiler
91 Other mentions of \*(C+.
97 This C<.> should be quoted.
101 This \f(CW\*(C`.\*(C'\fR should be quoted.
115 =item * Also a bullet.
152 Beyoncé! Beyoncé! Beyoncé!!
158 Older versions didn't convert Beyoncé in verbatim.
162 Beyonce\*'! Beyonce\*'! Beyonce\*'!!
165 \& Beyonce\*'! Beyonce\*'!
166 \& Beyonce\*'! Beyonce\*'!
167 \& Beyonce\*'! Beyonce\*'!
170 Older versions didn't convert Beyonce\*' in verbatim.
176 =item 1. Not a number
178 =item 2. Spaced right
190 .IP "1. Not a number" 4
191 .IX Item "1. Not a number"
193 .IP "2. Spaced right" 4
194 .IX Item "2. Spaced right"
195 .IP "1 Not a number" 2
196 .IX Item "1 Not a number"
197 .IP "2 Spaced right" 2
198 .IX Item "2 Spaced right"
221 The quotes should be converted in the above to paired quotes.
225 \&\*(L"=over ... =back\*(R"
229 The quotes should be converted in the above to paired quotes.
235 It cost me E<165>12345! That should be an X.
239 It cost me X12345! That should be an X.
245 Open E<agrave> la shell. Previous versions mapped it wrong.
249 Open a\*` la shell. Previous versions mapped it wrong.
270 .IX Item "First level"
283 =item 1. Check fonts in @CARP_NOT test.
287 .ie n .IP "1. Check fonts in @CARP_NOT test." 4
288 .el .IP "1. Check fonts in \f(CW@CARP_NOT\fR test." 4
289 .IX Item "1. Check fonts in @CARP_NOT test."
295 There should not be double quotes: L<C<< (?>pattern) >>>.
298 .IX Header "LINK QUOTING"
299 There should not be double quotes: \f(CW\*(C`(?>pattern)\*(C'\fR.
303 =head1 SE<lt>E<gt> MAGIC
305 Magic should be applied S<RISC OS> to that.
308 .IX Header "S<> MAGIC"
309 Magic should be applied \s-1RISC\s0\ \s-1OS\s0 to that.
315 These should be identical.
317 Bippity boppity boo "The
320 Bippity boppity boo "The
324 .IX Header "MAGIC MONEY"
325 These should be identical.
327 Bippity boppity boo \*(L"The
328 price is \f(CW$100\fR.\*(R"
330 Bippity boppity boo \*(L"The
331 price is \f(CW$100\fR.\*(R"
337 "Stuff" (no guesswork)
341 Oboy, is this C++ "fun" yet! (guesswork)
344 "Stuff" (no guesswork)
346 .IX Subsection "THINGS"
347 Oboy, is this \*(C+ \*(L"fun\*(R" yet! (guesswork)
351 =head1 Newline C Quote Weirdness
356 .SH "Newline C Quote Weirdness"
357 .IX Header "Newline C Quote Weirdness"
363 =head1 Soft Hypen Testing
367 JarkE<shy>ko HieE<shy>taE<shy>nieE<shy>mi
373 JarkE<173>ko HieE<173>taE<173>nieE<173>mi
379 JarkE<0x00AD>ko HieE<0x00AD>taE<0x00AD>nieE<0x00AD>mi
381 .SH "Soft Hypen Testing"
382 .IX Header "Soft Hypen Testing"
385 Jark\%ko Hie\%ta\%nie\%mi
391 Jark\%ko Hie\%ta\%nie\%mi
397 Jark\%ko Hie\%ta\%nie\%mi
401 =head1 XE<lt>E<gt> Whitespace
403 Blorpy L<B<prok>|blap> X<bivav> wugga chachacha.
406 .IX Header "X<> Whitespace"
407 Blorpy \fBprok\fR wugga chachacha.
412 =head1 Hyphen in SE<lt>E<gt>
414 Don't S<transform even-this hyphen>.
417 .IX Header "Hyphen in S<>"
418 Don't transform\ even-this\ hyphen.