Commit | Line | Data |
---|---|---|
69473a20 SP |
1 | #!/usr/bin/perl -w |
2 | ||
3 | # t/xhtml05.t - check block output from Pod::Simple::XHTML | |
4 | ||
5 | BEGIN { | |
6 | chdir 't' if -d 't'; | |
7 | } | |
8 | ||
9 | use strict; | |
10 | use lib '../lib'; | |
11 | use Test::More tests => 6; | |
12 | ||
13 | use_ok('Pod::Simple::XHTML') or exit; | |
14 | ||
15 | my $parser = Pod::Simple::XHTML->new (); | |
16 | isa_ok ($parser, 'Pod::Simple::XHTML'); | |
17 | ||
18 | my $results; | |
19 | initialize($parser, $results); | |
20 | $parser->accept_targets_as_text( 'comment' ); | |
21 | $parser->parse_string_document(<<'EOPOD'); | |
22 | =for comment | |
23 | This is an ordinary for block. | |
24 | ||
25 | EOPOD | |
26 | ||
27 | is($results, <<'EOHTML', "a for block"); | |
28 | <div class="comment"> | |
29 | ||
30 | <p>This is an ordinary for block.</p> | |
31 | ||
32 | </div> | |
33 | ||
34 | EOHTML | |
35 | ||
40fcdb56 | 36 | foreach my $target (qw(note tip warning)) { |
69473a20 SP |
37 | initialize($parser, $results); |
38 | $parser->accept_targets_as_text( $target ); | |
39 | $parser->parse_string_document(<<"EOPOD"); | |
40 | =begin $target | |
41 | ||
42 | This is a $target. | |
43 | ||
44 | =end $target | |
45 | EOPOD | |
46 | ||
47 | is($results, <<"EOHTML", "allow $target blocks"); | |
48 | <div class="$target"> | |
49 | ||
50 | <p>This is a $target.</p> | |
51 | ||
52 | </div> | |
53 | ||
54 | EOHTML | |
55 | ||
56 | } | |
57 | ||
58 | ###################################### | |
59 | ||
60 | sub initialize { | |
61 | $_[0] = Pod::Simple::XHTML->new (); | |
62 | $_[0]->html_header(""); | |
63 | $_[0]->html_footer(""); | |
64 | $_[0]->output_string( \$results ); # Send the resulting output to a string | |
65 | $_[1] = ''; | |
66 | return; | |
67 | } |