Actually note that Shell.pm is deprecated for 5.13 and 5.14, so we can
[p5sagit/p5-mst-13.2.git] / cpan / podlators / t / overstrike.t
1 #!/usr/bin/perl -w
2 #
3 # overstrike.t -- Additional specialized tests for Pod::Text::Overstrike.
4 #
5 # Copyright 2002, 2004, 2006, 2009 by Russ Allbery <rra@stanford.edu>
6 #
7 # This program is free software; you may redistribute it and/or modify it
8 # under the same terms as Perl itself.
9
10 BEGIN {
11     chdir 't' if -d 't';
12     if ($ENV{PERL_CORE}) {
13         @INC = '../lib';
14     }
15     unshift (@INC, '../blib/lib');
16     $| = 1;
17 }
18
19 use strict;
20
21 use Test::More tests => 4;
22 BEGIN { use_ok ('Pod::Text::Overstrike') }
23
24 my $parser = Pod::Text::Overstrike->new;
25 isa_ok ($parser, 'Pod::Text::Overstrike', 'Parser module');
26 my $n = 1;
27 while (<DATA>) {
28     next until $_ eq "###\n";
29     open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
30     while (<DATA>) {
31         last if $_ eq "###\n";
32         print TMP $_;
33     }
34     close TMP;
35     open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
36     $parser->parse_from_file ('tmp.pod', \*OUT);
37     close OUT;
38     open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
39     my $output;
40     {
41         local $/;
42         $output = <TMP>;
43     }
44     close TMP;
45     1 while unlink ('tmp.pod', 'out.tmp');
46     my $expected = '';
47     while (<DATA>) {
48         last if $_ eq "###\n";
49         $expected .= $_;
50     }
51     is ($output, $expected, "Output correct for test $n");
52     $n++;
53 }
54
55 # Below the marker are bits of POD and corresponding expected output.  This is
56 # used to test specific features or problems with Pod::Text::Termcap.  The
57 # input and output are separated by lines containing only ###.
58
59 __DATA__
60
61 ###
62 =head1 WRAPPING
63
64 B<I<Do>> I<B<not>> B<I<include>> B<I<formatting codes when>> B<I<wrapping>>.
65 ###
66 W\bWR\bRA\bAP\bPP\bPI\bIN\bNG\bG
67     D\bDo\bo _\bn_\bo_\bt i\bin\bnc\bcl\blu\bud\bde\be f\bfo\bor\brm\bma\bat\btt\bti\bin\bng\b\b c\bco\bod\bde\bes\b\b w\bwh\bhe\ben\bn w\bwr\bra\bap\bpp\bpi\bin\bng\bg.
68
69 ###
70
71 ###
72 =head1 TAG WIDTH
73
74 =over 10
75
76 =item 12345678
77
78 A
79
80 =item B<12345678>
81
82 B
83
84 =item 1
85
86 C
87
88 =item B<1>
89
90 D
91
92 =back
93 ###
94 T\bTA\bAG\b\b W\bWI\bID\bDT\bTH\bH
95     12345678  A
96
97     1\b12\b23\b34\b45\b56\b67\b78\b8  B
98
99     1         C
100
101     1\b1         D
102
103 ###