~ubuntu-branches/ubuntu/hardy/libpod-simple-perl/hardy

« back to all changes in this revision

Viewing changes to t/ac_d.t

  • Committer: Bazaar Package Importer
  • Author(s): Jay Bonci
  • Date: 2004-01-02 15:38:21 UTC
  • Revision ID: james.westby@ubuntu.com-20040102153821-ezu9yx6kwbygkaae
Tags: upstream-2.05
ImportĀ upstreamĀ versionĀ 2.05

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
use strict;
 
3
use Test;
 
4
BEGIN { plan tests => 14 };
 
5
 
 
6
#use Pod::Simple::Debug (6);
 
7
 
 
8
use Pod::Simple::DumpAsXML;
 
9
use Pod::Simple::XMLOutStream;
 
10
print "# Pod::Simple version $Pod::Simple::VERSION\n";
 
11
 
 
12
$Pod::Simple::XMLOutStream::ATTR_PAD   = ' ';
 
13
$Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output
 
14
 
 
15
#sub e ($$) { Pod::Simple::DumpAsXML->_duo(@_) }
 
16
 
 
17
$Pod::Simple::XMLOutStream::ATTR_PAD   = ' ';
 
18
$Pod::Simple::XMLOutStream::SORT_ATTRS = 1; # for predictably testable output
 
19
 
 
20
my $x = 'Pod::Simple::XMLOutStream';
 
21
 
 
22
ok 1;
 
23
 
 
24
print "# Testing exceptions being thrown...\n";
 
25
 
 
26
eval { $x->new->accept_directive('head1') };
 
27
if($@) { ok 1 } # print " # Good: exception thrown: $@\n" }
 
28
else   { ok 0,1, 'No exception thrown!' }
 
29
 
 
30
eval { $x->new->accept_directive('I like pie') };
 
31
if($@) { ok 1 } # print " # Good: exception thrown: $@\n" }
 
32
else   { ok 0,1, 'No exception thrown!' }
 
33
 
 
34
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
35
# print "Testing basic directive behavior...\n";
 
36
 
 
37
sub Pd { shift->accept_directive_as_data(     'freepies') }
 
38
sub Pv { shift->accept_directive_as_verbatim( 'freepies') }
 
39
sub Pp { shift->accept_directive_as_processed('freepies') }
 
40
 
 
41
ok( $x->_out( "\n=freepies Mmmmpie\n\n") => '/POD ERROR/' );
 
42
 
 
43
ok( $x->_out(\&Pp, "\n=freepies Mmmmpie\n\n"),
 
44
  '<Document><freepies>Mmmmpie</freepies></Document>'
 
45
);
 
46
ok( $x->_out(\&Pv, "\n=freepies Mmmmpie\n\n"),
 
47
  '<Document><freepies xml:space="preserve">Mmmmpie</freepies></Document>'
 
48
);
 
49
ok( $x->_out(\&Pd, "\n=freepies Mmmmpie\n\n"),
 
50
  '<Document><freepies xml:space="preserve">Mmmmpie</freepies></Document>'
 
51
);
 
52
 
 
53
# print "Testing more complex directive behavior...\n";
 
54
 
 
55
ok( $x->_out(\&Pp, "\n=freepies Mmmmpie \n\tI<is good>!  \n\n"),
 
56
  '<Document><freepies>Mmmmpie <I>is good</I>!</freepies></Document>'
 
57
);
 
58
ok( $x->_out(\&Pd, "\n=freepies Mmmmpie \n\tI<is good>!  \n\n"),
 
59
 qq{<Document><freepies xml:space="preserve">Mmmmpie \n\tI&#60;is good&#62;!  </freepies></Document>}
 
60
);
 
61
ok( $x->_out(\&Pv, "\n=freepies Mmmmpie \n\tI<is good>!  \n\n"),
 
62
 qq{<Document><freepies xml:space="preserve">Mmmmpie \n        I&#60;is good&#62;!  </freepies></Document>}
 
63
);
 
64
 
 
65
# print "Testing within larger documents...\n";
 
66
 
 
67
 
 
68
ok( $x->_out(\&Pp, "\n=head1 NAME\n\nPie Consortium -- me gustan pasteles\n\n=freepies Mmmmpie \n\tI<is good>!  \n\nGoody!"),
 
69
  '<Document><head1>NAME</head1><Para>Pie Consortium -- me gustan pasteles</Para><freepies>Mmmmpie <I>is good</I>!</freepies><Para>Goody!</Para></Document>'
 
70
);
 
71
ok( $x->_out(\&Pd, "\n=head1 NAME\n\nPie Consortium -- me gustan pasteles\n\n=freepies Mmmmpie \n\tI<is good>!  \n\nGoody!"),
 
72
 qq{<Document><head1>NAME</head1><Para>Pie Consortium -- me gustan pasteles</Para><freepies xml:space="preserve">Mmmmpie \n\tI&#60;is good&#62;!  </freepies><Para>Goody!</Para></Document>}
 
73
);
 
74
ok( $x->_out(\&Pv, "\n=head1 NAME\n\nPie Consortium -- me gustan pasteles\n\n=freepies Mmmmpie \n\tI<is good>!  \n\nGoody!"),
 
75
 qq{<Document><head1>NAME</head1><Para>Pie Consortium -- me gustan pasteles</Para><freepies xml:space="preserve">Mmmmpie \n        I&#60;is good&#62;!  </freepies><Para>Goody!</Para></Document>}
 
76
);
 
77
 
 
78
 
 
79
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
80
 
 
81
print "# Wrapping up... one for the road...\n";
 
82
ok 1;
 
83
print "# --- Done with ", __FILE__, " --- \n";
 
84
 
 
85
 
 
86
__END__
 
87