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 $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";
49 open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
50 $parser->parse_from_file ('tmp.pod', \*OUT);
52 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
53 while (<OUT>) { last if /^\.nh/ }
60 unlink ('tmp.pod', 'out.tmp');
63 last if $_ eq "###\n";
66 if ($output eq $expected) {
70 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
75 # Below the marker are bits of POD and corresponding expected nroff output.
76 # This is used to test specific features or problems with Pod::Man. The input
77 # and output are separated by lines containing only ###.
84 gcc - GNU project C and C++ compiler
88 Other mentions of C++.
91 gcc \- GNU project C and C++ compiler
94 Other mentions of \*(C+.
100 This C<.> should be quoted.
104 This \f(CW\*(C`.\*(C'\fR should be quoted.
118 =item * Also a bullet.
155 Beyoncé! Beyoncé! Beyoncé!!
161 Older versions didn't convert Beyoncé in verbatim.
165 Beyonce\*'! Beyonce\*'! Beyonce\*'!!
168 \& Beyonce\*'! Beyonce\*'!
169 \& Beyonce\*'! Beyonce\*'!
170 \& Beyonce\*'! Beyonce\*'!
173 Older versions didn't convert Beyonce\*' in verbatim.
179 =item 1. Not a number
181 =item 2. Spaced right
193 .IP "1. Not a number" 4
194 .IX Item "1. Not a number"
196 .IP "2. Spaced right" 4
197 .IX Item "2. Spaced right"
198 .IP "1 Not a number" 2
199 .IX Item "1 Not a number"
200 .IP "2 Spaced right" 2
201 .IX Item "2 Spaced right"
224 The quotes should be converted in the above to paired quotes.
228 \&\*(L"=over ... =back\*(R"
232 The quotes should be converted in the above to paired quotes.
238 It cost me E<165>12345! That should be an X.
242 It cost me X12345! That should be an X.
248 Open E<agrave> la shell. Previous versions mapped it wrong.
252 Open a\*` la shell. Previous versions mapped it wrong.
273 .IX Item "First level"
286 =item 1. Check fonts in @CARP_NOT test.
290 .ie n .IP "1. Check fonts in @CARP_NOT test." 4
291 .el .IP "1. Check fonts in \f(CW@CARP_NOT\fR test." 4
292 .IX Item "1. Check fonts in @CARP_NOT test."
298 There should not be double quotes: L<C<< (?>pattern) >>>.
301 .IX Header "LINK QUOTING"
302 There should not be double quotes: \f(CW\*(C`(?>pattern)\*(C'\fR.
306 =head1 SE<lt>E<gt> MAGIC
308 Magic should be applied S<RISC OS> to that.
311 .IX Header "S<> MAGIC"
312 Magic should be applied \s-1RISC\s0\ \s-1OS\s0 to that.
318 These should be identical.
320 Bippity boppity boo "The
323 Bippity boppity boo "The
327 .IX Header "MAGIC MONEY"
328 These should be identical.
330 Bippity boppity boo \*(L"The
331 price is \f(CW$100\fR.\*(R"
333 Bippity boppity boo \*(L"The
334 price is \f(CW$100\fR.\*(R"
340 "Stuff" (no guesswork)
344 Oboy, is this C++ "fun" yet! (guesswork)
347 "Stuff" (no guesswork)
349 .IX Subsection "THINGS"
350 Oboy, is this \*(C+ \*(L"fun\*(R" yet! (guesswork)
354 =head1 Newline C Quote Weirdness
359 .SH "Newline C Quote Weirdness"
360 .IX Header "Newline C Quote Weirdness"
366 =head1 Soft Hypen Testing
370 JarkE<shy>ko HieE<shy>taE<shy>nieE<shy>mi
376 JarkE<173>ko HieE<173>taE<173>nieE<173>mi
382 JarkE<0x00AD>ko HieE<0x00AD>taE<0x00AD>nieE<0x00AD>mi
384 .SH "Soft Hypen Testing"
385 .IX Header "Soft Hypen Testing"
388 Jark\%ko Hie\%ta\%nie\%mi
394 Jark\%ko Hie\%ta\%nie\%mi
400 Jark\%ko Hie\%ta\%nie\%mi
404 =head1 XE<lt>E<gt> Whitespace
406 Blorpy L<B<prok>|blap> X<bivav> wugga chachacha.
409 .IX Header "X<> Whitespace"
410 Blorpy \fBprok\fR wugga chachacha.
415 =head1 Hyphen in SE<lt>E<gt>
417 Don't S<transform even-this hyphen>. This "one's-fine!", as well. However,
418 $-0.13 should have a real hyphen.
421 .IX Header "Hyphen in S<>"
422 Don't transform\ even-this\ hyphen. This \*(L"one's-fine!\*(R", as well. However,
423 $\-0.13 should have a real hyphen.