Commit | Line | Data |
2da3dd12 |
1 | #!/usr/bin/perl -w |
42ae9e1d |
2 | # $Id: man.t,v 1.10 2006-09-16 20:25:25 eagle Exp $ |
2da3dd12 |
3 | # |
4 | # man.t -- Additional specialized tests for Pod::Man. |
5 | # |
8f202758 |
6 | # Copyright 2002, 2003, 2004, 2006 by Russ Allbery <rra@stanford.edu> |
2da3dd12 |
7 | # |
8 | # This program is free software; you may redistribute it and/or modify it |
9 | # under the same terms as Perl itself. |
10 | |
11 | BEGIN { |
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; |
b7ae008f |
20 | print "1..21\n"; |
2da3dd12 |
21 | } |
22 | |
23 | END { |
24 | print "not ok 1\n" unless $loaded; |
25 | } |
26 | |
27 | use Pod::Man; |
28 | |
29 | $loaded = 1; |
30 | print "ok 1\n"; |
31 | |
0a37092f |
32 | my $have_encoding = eval { require PerlIO::encoding; 1; } && ! $@; |
33 | |
8f202758 |
34 | my $parser = Pod::Man->new or die "Cannot create parser\n"; |
35 | my $n = 2; |
2da3dd12 |
36 | while (<DATA>) { |
37 | next until $_ eq "###\n"; |
38 | open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n"; |
8f202758 |
39 | |
40 | # We have a test in ISO 8859-1 encoding. Make sure that nothing strange |
0a37092f |
41 | # happens if Perl thinks the world is Unicode. |
42 | binmode (\*TMP, ':encoding(iso-8859-1)') if $have_encoding; |
8f202758 |
43 | |
2da3dd12 |
44 | while (<DATA>) { |
45 | last if $_ eq "###\n"; |
4bd7b839 |
46 | no warnings 'utf8'; |
2da3dd12 |
47 | print TMP $_; |
48 | } |
49 | close TMP; |
e2a52b10 |
50 | open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n"; |
51 | $parser->parse_from_file ('tmp.pod', \*OUT); |
52 | close OUT; |
b7ae008f |
53 | open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n"; |
42ae9e1d |
54 | while (<OUT>) { last if /^\.nh/ } |
2da3dd12 |
55 | my $output; |
56 | { |
57 | local $/; |
b7ae008f |
58 | $output = <OUT>; |
2da3dd12 |
59 | } |
b7ae008f |
60 | close OUT; |
2da3dd12 |
61 | unlink ('tmp.pod', 'out.tmp'); |
62 | my $expected = ''; |
63 | while (<DATA>) { |
64 | last if $_ eq "###\n"; |
65 | $expected .= $_; |
66 | } |
67 | if ($output eq $expected) { |
68 | print "ok $n\n"; |
69 | } else { |
70 | print "not ok $n\n"; |
71 | print "Expected\n========\n$expected\nOutput\n======\n$output\n"; |
72 | } |
73 | $n++; |
74 | } |
75 | |
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 ###. |
79 | |
80 | __DATA__ |
81 | |
82 | ### |
83 | =head1 NAME |
84 | |
85 | gcc - GNU project C and C++ compiler |
86 | |
87 | =head1 C++ NOTES |
88 | |
89 | Other mentions of C++. |
90 | ### |
91 | .SH "NAME" |
92 | gcc \- GNU project C and C++ compiler |
93 | .SH "\*(C+ NOTES" |
94 | .IX Header " NOTES" |
95 | Other mentions of \*(C+. |
96 | ### |
f011ec7d |
97 | |
98 | ### |
99 | =head1 PERIODS |
100 | |
101 | This C<.> should be quoted. |
102 | ### |
103 | .SH "PERIODS" |
104 | .IX Header "PERIODS" |
105 | This \f(CW\*(C`.\*(C'\fR should be quoted. |
106 | ### |
4213be12 |
107 | |
108 | ### |
109 | =over 4 |
110 | |
111 | =item * |
112 | |
113 | A bullet. |
114 | |
115 | =item * |
116 | |
117 | Another bullet. |
118 | |
b7ae008f |
119 | =item * Also a bullet. |
4213be12 |
120 | |
121 | =back |
122 | ### |
123 | .IP "\(bu" 4 |
124 | A bullet. |
125 | .IP "\(bu" 4 |
126 | Another bullet. |
b7ae008f |
127 | .IP "\(bu" 4 |
128 | Also a bullet. |
4213be12 |
129 | ### |
130 | |
131 | ### |
132 | =over 4 |
133 | |
134 | =item foo |
135 | |
136 | Not a bullet. |
137 | |
138 | =item * |
139 | |
140 | Also not a bullet. |
141 | |
142 | =back |
143 | ### |
144 | .IP "foo" 4 |
145 | .IX Item "foo" |
146 | Not a bullet. |
147 | .IP "*" 4 |
148 | Also not a bullet. |
149 | ### |
b7ae008f |
150 | |
151 | ### |
8f202758 |
152 | =encoding iso-8859-1 |
153 | |
154 | =head1 ACCENTS |
155 | |
156 | Beyoncé! Beyoncé! Beyoncé!! |
157 | |
158 | Beyoncé! Beyoncé! |
159 | Beyoncé! Beyoncé! |
160 | Beyoncé! Beyoncé! |
161 | |
162 | Older versions didn't convert Beyoncé in verbatim. |
163 | ### |
164 | .SH "ACCENTS" |
165 | .IX Header "ACCENTS" |
166 | Beyonce\*'! Beyonce\*'! Beyonce\*'!! |
167 | .PP |
168 | .Vb 3 |
169 | \& Beyonce\*'! Beyonce\*'! |
170 | \& Beyonce\*'! Beyonce\*'! |
171 | \& Beyonce\*'! Beyonce\*'! |
172 | .Ve |
173 | .PP |
174 | Older versions didn't convert Beyonce\*' in verbatim. |
175 | ### |
176 | |
177 | ### |
b7ae008f |
178 | =over 4 |
179 | |
180 | =item 1. Not a number |
181 | |
182 | =item 2. Spaced right |
183 | |
184 | =back |
185 | |
186 | =over 2 |
187 | |
188 | =item 1 Not a number |
189 | |
190 | =item 2 Spaced right |
191 | |
192 | =back |
193 | ### |
194 | .IP "1. Not a number" 4 |
195 | .IX Item "1. Not a number" |
196 | .PD 0 |
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" |
203 | ### |
204 | |
205 | ### |
206 | =over 4 |
207 | |
208 | =item Z<>* |
209 | |
210 | Not bullet. |
211 | |
212 | =back |
213 | ### |
214 | .IP "*" 4 |
215 | Not bullet. |
216 | ### |
217 | |
218 | ### |
219 | =head1 SEQS |
220 | |
221 | "=over ... Z<>=back" |
222 | |
223 | "SE<lt>...E<gt>" |
224 | |
225 | The quotes should be converted in the above to paired quotes. |
226 | ### |
227 | .SH "SEQS" |
228 | .IX Header "SEQS" |
229 | \&\*(L"=over ... =back\*(R" |
230 | .PP |
231 | \&\*(L"S<...>\*(R" |
232 | .PP |
233 | The quotes should be converted in the above to paired quotes. |
234 | ### |
235 | |
236 | ### |
237 | =head1 YEN |
238 | |
239 | It cost me E<165>12345! That should be an X. |
240 | ### |
241 | .SH "YEN" |
242 | .IX Header "YEN" |
243 | It cost me X12345! That should be an X. |
244 | ### |
245 | |
246 | ### |
247 | =head1 agrave |
248 | |
249 | Open E<agrave> la shell. Previous versions mapped it wrong. |
250 | ### |
251 | .SH "agrave" |
252 | .IX Header "agrave" |
253 | Open a\*` la shell. Previous versions mapped it wrong. |
254 | ### |
255 | |
256 | ### |
257 | =over |
258 | |
259 | =item First level |
260 | |
261 | Blah blah blah.... |
262 | |
263 | =over |
264 | |
265 | =item * |
266 | |
267 | Should be a bullet. |
268 | |
269 | =back |
270 | |
271 | =back |
272 | ### |
273 | .IP "First level" 4 |
274 | .IX Item "First level" |
275 | Blah blah blah.... |
276 | .RS 4 |
277 | .IP "\(bu" 4 |
278 | Should be a bullet. |
279 | .RE |
280 | .RS 4 |
281 | .RE |
282 | ### |
283 | |
284 | ### |
285 | =over 4 |
286 | |
287 | =item 1. Check fonts in @CARP_NOT test. |
288 | |
289 | =back |
290 | ### |
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." |
294 | ### |
295 | |
296 | ### |
297 | =head1 LINK QUOTING |
298 | |
299 | There should not be double quotes: L<C<< (?>pattern) >>>. |
300 | ### |
301 | .SH "LINK QUOTING" |
302 | .IX Header "LINK QUOTING" |
303 | There should not be double quotes: \f(CW\*(C`(?>pattern)\*(C'\fR. |
304 | ### |
305 | |
306 | ### |
307 | =head1 SE<lt>E<gt> MAGIC |
308 | |
309 | Magic should be applied S<RISC OS> to that. |
310 | ### |
311 | .SH "S<> MAGIC" |
312 | .IX Header "S<> MAGIC" |
313 | Magic should be applied \s-1RISC\s0\ \s-1OS\s0 to that. |
314 | ### |
315 | |
316 | ### |
317 | =head1 MAGIC MONEY |
318 | |
319 | These should be identical. |
320 | |
321 | Bippity boppity boo "The |
322 | price is $Z<>100." |
323 | |
324 | Bippity boppity boo "The |
325 | price is $100." |
326 | ### |
327 | .SH "MAGIC MONEY" |
328 | .IX Header "MAGIC MONEY" |
329 | These should be identical. |
330 | .PP |
331 | Bippity boppity boo \*(L"The |
332 | price is \f(CW$100\fR.\*(R" |
333 | .PP |
334 | Bippity boppity boo \*(L"The |
335 | price is \f(CW$100\fR.\*(R" |
336 | ### |
337 | |
338 | ### |
339 | =head1 NAME |
340 | |
341 | "Stuff" (no guesswork) |
342 | |
343 | =head2 THINGS |
344 | |
345 | Oboy, is this C++ "fun" yet! (guesswork) |
346 | ### |
347 | .SH "NAME" |
348 | "Stuff" (no guesswork) |
349 | .Sh "\s-1THINGS\s0" |
350 | .IX Subsection "THINGS" |
351 | Oboy, is this \*(C+ \*(L"fun\*(R" yet! (guesswork) |
352 | ### |
353 | |
354 | ### |
355 | =head1 Newline C Quote Weirdness |
356 | |
357 | Blorp C<' |
358 | ''>. Yes. |
359 | ### |
360 | .SH "Newline C Quote Weirdness" |
361 | .IX Header "Newline C Quote Weirdness" |
362 | Blorp \f(CW' |
363 | \&''\fR. Yes. |
364 | ### |
365 | |
366 | ### |
367 | =head1 Soft Hypen Testing |
368 | |
369 | sigE<shy>action |
370 | manuE<shy>script |
371 | JarkE<shy>ko HieE<shy>taE<shy>nieE<shy>mi |
372 | |
373 | And again: |
374 | |
375 | sigE<173>action |
376 | manuE<173>script |
377 | JarkE<173>ko HieE<173>taE<173>nieE<173>mi |
378 | |
379 | And one more time: |
380 | |
381 | sigE<0x00AD>action |
382 | manuE<0x00AD>script |
383 | JarkE<0x00AD>ko HieE<0x00AD>taE<0x00AD>nieE<0x00AD>mi |
384 | ### |
385 | .SH "Soft Hypen Testing" |
386 | .IX Header "Soft Hypen Testing" |
387 | sig\%action |
388 | manu\%script |
389 | Jark\%ko Hie\%ta\%nie\%mi |
390 | .PP |
391 | And again: |
392 | .PP |
393 | sig\%action |
394 | manu\%script |
395 | Jark\%ko Hie\%ta\%nie\%mi |
396 | .PP |
397 | And one more time: |
398 | .PP |
399 | sig\%action |
400 | manu\%script |
401 | Jark\%ko Hie\%ta\%nie\%mi |
402 | ### |
403 | |
404 | ### |
405 | =head1 XE<lt>E<gt> Whitespace |
406 | |
407 | Blorpy L<B<prok>|blap> X<bivav> wugga chachacha. |
408 | ### |
409 | .SH "X<> Whitespace" |
410 | .IX Header "X<> Whitespace" |
411 | Blorpy \fBprok\fR wugga chachacha. |
412 | .IX Xref "bivav" |
413 | ### |
414 | |
415 | ### |
416 | =head1 Hyphen in SE<lt>E<gt> |
417 | |
42ae9e1d |
418 | Don't S<transform even-this hyphen>. This "one's-fine!", as well. However, |
419 | $-0.13 should have a real hyphen. |
b7ae008f |
420 | ### |
421 | .SH "Hyphen in S<>" |
422 | .IX Header "Hyphen in S<>" |
42ae9e1d |
423 | Don't transform\ even-this\ hyphen. This \*(L"one's-fine!\*(R", as well. However, |
424 | $\-0.13 should have a real hyphen. |
b7ae008f |
425 | ### |