This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move Pod::Simple from ext/ to cpan/
[perl5.git] / cpan / Pod-Simple / t / html01.t
1 # t/html-para.t
2
3 BEGIN {
4     if($ENV{PERL_CORE}) {
5         chdir 't';
6         @INC = '../lib';
7     }
8 }
9
10 use strict;
11 use Test;
12 BEGIN { plan tests => 8 };
13
14 #use Pod::Simple::Debug (10);
15
16 use Pod::Simple::HTML;
17
18 sub x ($) { Pod::Simple::HTML->_out(
19   sub{  $_[0]->bare_output(1)  },
20   "=pod\n\n$_[0]",
21 ) }
22
23 ok( x(
24 q{
25 =pod
26  
27 This is a paragraph
28  
29 =cut
30 }),
31   qq{\n<p>This is a paragraph</p>\n},
32   "paragraph building"
33 );
34
35
36 ok( x(qq{=pod\n\nThis is a paragraph}),
37  qq{\n<p>This is a paragraph</p>\n},
38  "paragraph building"
39 );
40
41
42 ok( x(qq{This is a paragraph}),
43  qq{\n<p>This is a paragraph</p>\n},
44  "paragraph building"
45 );
46
47
48
49 ok(x(
50 '=head1 This is a heading')
51  => q{/\s*<h1><a[^<>]+>This\s+is\s+a\s+heading</a></h1>\s*$/},
52   "heading building"
53 );
54
55 ok(x(
56 '=head2 This is a heading too')
57  => q{/\s*<h2><a[^<>]+>This\s+is\s+a\s+heading\s+too</a></h2>\s*$/},
58   "heading building"
59 );
60
61 ok(x(
62 '=head3 Also, this is a heading')
63  => q{/\s*<h3><a[^<>]+>Also,\s+this\s+is\s+a\s+heading</a></h3>\s*$/},
64   "heading building"
65 );
66
67
68 ok(x(
69 '=head4 This, too, is a heading')
70  => q{/\s*<h4><a[^<>]+>This,\s+too,\s+is\s+a\s+heading</a></h4>\s*$/},
71   "heading building"
72 );
73
74
75 print "# And one for the road...\n";
76 ok 1;
77