2 # $Id: man.t,v 1.5 2004/02/15 06:42:49 eagle Exp $
4 # man.t -- Additional specialized tests for Pod::Man.
6 # Copyright 2002, 2003, 2004 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;
33 if (defined $ENV{PERL_UNICODE}) {
34 print "not ok 2 # TODO Unicode not yet supported\n"
39 Beyoncé! Beyoncé! Beyoncé!!
45 Older versions didn't convert Beyoncé in verbatim.
48 my $expected = <<"EOM";
51 Beyonce\\*'! Beyonce\\*'! Beyonce\\*'!!
54 \\& Beyonce\\*'! Beyonce\\*'!
55 \\& Beyonce\\*'! Beyonce\\*'!
56 \\& Beyonce\\*'! Beyonce\\*'!
59 Older versions didn't convert Beyonce\\*' in verbatim.
61 $parser = Pod::Man->new or die "Cannot create parser\n";
62 open my $out_fh, ">", 'out.tmp' or die "Can't open \$out_fh: $!";
63 $parser->output_fh($out_fh);
64 $parser->parse_string_document($pod);
66 open my $in_fh, "<", 'out.tmp' or die "Can't open \$in_fh: $!";
67 while (<$in_fh>) { last if /^\.TH/; }
75 if ($man eq $expected) {
79 print "Expected\n========\n$expected\nOutput\n======\n$man\n";
86 next until $_ eq "###\n";
87 open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
89 last if $_ eq "###\n";
93 my $parser = Pod::Man->new or die "Cannot create parser\n";
94 $parser->parse_from_file ('tmp.pod', 'out.tmp');
96 open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
97 while (<OUT>) { last if /^\.TH/ }
104 unlink ('tmp.pod', 'out.tmp');
107 last if $_ eq "###\n";
110 if ($output eq $expected) {
114 print "Expected\n========\n$expected\nOutput\n======\n$output\n";
119 # Below the marker are bits of POD and corresponding expected nroff output.
120 # This is used to test specific features or problems with Pod::Man. The input
121 # and output are separated by lines containing only ###.
128 gcc - GNU project C and C++ compiler
132 Other mentions of C++.
135 gcc \- GNU project C and C++ compiler
138 Other mentions of \*(C+.
144 This C<.> should be quoted.
148 This \f(CW\*(C`.\*(C'\fR should be quoted.
162 =item * Also a bullet.
197 =item 1. Not a number
199 =item 2. Spaced right
211 .IP "1. Not a number" 4
212 .IX Item "1. Not a number"
214 .IP "2. Spaced right" 4
215 .IX Item "2. Spaced right"
216 .IP "1 Not a number" 2
217 .IX Item "1 Not a number"
218 .IP "2 Spaced right" 2
219 .IX Item "2 Spaced right"
242 The quotes should be converted in the above to paired quotes.
246 \&\*(L"=over ... =back\*(R"
250 The quotes should be converted in the above to paired quotes.
256 It cost me E<165>12345! That should be an X.
260 It cost me X12345! That should be an X.
266 Open E<agrave> la shell. Previous versions mapped it wrong.
270 Open a\*` la shell. Previous versions mapped it wrong.
291 .IX Item "First level"
304 =item 1. Check fonts in @CARP_NOT test.
308 .ie n .IP "1. Check fonts in @CARP_NOT test." 4
309 .el .IP "1. Check fonts in \f(CW@CARP_NOT\fR test." 4
310 .IX Item "1. Check fonts in @CARP_NOT test."
316 There should not be double quotes: L<C<< (?>pattern) >>>.
319 .IX Header "LINK QUOTING"
320 There should not be double quotes: \f(CW\*(C`(?>pattern)\*(C'\fR.
324 =head1 SE<lt>E<gt> MAGIC
326 Magic should be applied S<RISC OS> to that.
329 .IX Header "S<> MAGIC"
330 Magic should be applied \s-1RISC\s0\ \s-1OS\s0 to that.
336 These should be identical.
338 Bippity boppity boo "The
341 Bippity boppity boo "The
345 .IX Header "MAGIC MONEY"
346 These should be identical.
348 Bippity boppity boo \*(L"The
349 price is \f(CW$100\fR.\*(R"
351 Bippity boppity boo \*(L"The
352 price is \f(CW$100\fR.\*(R"
358 "Stuff" (no guesswork)
362 Oboy, is this C++ "fun" yet! (guesswork)
365 "Stuff" (no guesswork)
367 .IX Subsection "THINGS"
368 Oboy, is this \*(C+ \*(L"fun\*(R" yet! (guesswork)
372 =head1 Newline C Quote Weirdness
377 .SH "Newline C Quote Weirdness"
378 .IX Header "Newline C Quote Weirdness"
384 =head1 Soft Hypen Testing
388 JarkE<shy>ko HieE<shy>taE<shy>nieE<shy>mi
394 JarkE<173>ko HieE<173>taE<173>nieE<173>mi
400 JarkE<0x00AD>ko HieE<0x00AD>taE<0x00AD>nieE<0x00AD>mi
402 .SH "Soft Hypen Testing"
403 .IX Header "Soft Hypen Testing"
406 Jark\%ko Hie\%ta\%nie\%mi
412 Jark\%ko Hie\%ta\%nie\%mi
418 Jark\%ko Hie\%ta\%nie\%mi
422 =head1 XE<lt>E<gt> Whitespace
424 Blorpy L<B<prok>|blap> X<bivav> wugga chachacha.
427 .IX Header "X<> Whitespace"
428 Blorpy \fBprok\fR wugga chachacha.
433 =head1 Hyphen in SE<lt>E<gt>
435 Don't S<transform even-this hyphen>.
438 .IX Header "Hyphen in S<>"
439 Don't transform\ even-this\ hyphen.