Commit | Line | Data |
351625bd |
1 | BEGIN { |
2 | if($ENV{PERL_CORE}) { |
3 | chdir 't'; |
4 | @INC = '../lib'; |
5 | } |
6 | } |
7 | |
8 | use strict; |
9 | use Test; |
10 | BEGIN { plan tests => 8 }; |
11 | |
12 | my $d; |
13 | #use Pod::Simple::Debug (\$d, 0); |
14 | |
15 | ok 1; |
16 | |
17 | use Pod::Simple::XMLOutStream; |
18 | use Pod::Simple::DumpAsXML; |
19 | use Pod::Simple::DumpAsText; |
20 | |
21 | my @from = ( |
22 | 'Pod::Simple::XMLOutStream' |
23 | => '<Document><head1>I LIKE PIE</head1></Document>', |
24 | |
25 | 'Pod::Simple::DumpAsXML' |
26 | => "<Document>\n <head1>\n I LIKE PIE\n </head1>\n</Document>\n", |
27 | |
28 | 'Pod::Simple::DumpAsText' |
29 | => "++Document\n ++head1\n * \"I LIKE PIE\"\n --head1\n--Document\n", |
30 | |
31 | ); |
32 | |
33 | |
34 | # Might as well test all the classes... |
35 | while(@from) { |
36 | my($x => $expected) = splice(@from, 0,2); |
37 | my $more = ''; |
38 | print "#Testing via class $x, version ", $x->VERSION(), "\n"; |
39 | my $p = $x->new; |
40 | my($got, $exp); |
41 | ok scalar($got = $x->_out( |
42 | # Mutor: |
43 | sub { |
44 | $_[0]->code_handler(sub { $more .= $_[1] . ":" . $_[0] . "\n" } ); |
45 | $_[0]->cut_handler( sub { $more .= "~" . $_[1] . ":" . $_[0]. "\n" } ); |
46 | } => join "\n", |
47 | "", |
48 | "\t# This is handy...", |
49 | "=head1 I LIKE PIE", |
50 | "", |
51 | "=cut", |
52 | "use Test::Harness;", |
53 | "runtests(sort glob 't/*.t');", |
54 | "", |
55 | "", |
56 | )) |
57 | => scalar($exp = $expected); |
58 | ; |
59 | unless($got eq $exp) { |
60 | print '# Got vs exp:\n# ', Pod::Simple::BlackBox::pretty($got), |
61 | "\n# ",Pod::Simple::BlackBox::pretty($exp),"\n"; |
62 | } |
63 | |
64 | ok scalar($got = $more), scalar($exp = join "\n" => |
65 | "1:", |
66 | "2:\t# This is handy...", |
67 | "~5:=cut", |
68 | "6:use Test::Harness;", |
69 | "7:runtests(sort glob 't/*.t');", |
70 | "8:", |
71 | "", |
72 | ); |
73 | unless($got eq $exp) { |
74 | print '# Got vs exp:\n# ', Pod::Simple::BlackBox::pretty($got), |
75 | "\n# ",Pod::Simple::BlackBox::pretty($exp),"\n"; |
76 | } |
77 | } |
78 | |
79 | |
80 | print "# Wrapping up... one for the road...\n"; |
81 | ok 1; |
82 | print "# --- Done with ", __FILE__, " --- \n"; |
83 | |