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