[tests for Pod::Html]
[p5sagit/p5-mst-13.2.git] / lib / Pod / t / pod2html-lib.pl
1 require Cwd;
2 require Pod::Html;
3 require Config;
4 use File::Spec::Functions;
5
6 sub convert_n_test {
7     my($podfile, $testname) = @_;
8
9     my $cwd = Cwd::cwd();
10     my $new_dir = catdir $cwd, "..", "lib", "Pod", "t";
11     my $infile  = catfile $new_dir, "$podfile.pod";
12     my $outfile = catfile $new_dir, "$podfile.html";
13
14     Pod::Html::pod2html(
15         "--podpath=pod2html",
16         "--podroot=$cwd",
17         "--htmlroot=/",
18         "--infile=$infile",
19         "--outfile=$outfile"
20     );
21
22
23     local $/;
24     # expected
25     my $expect = <DATA>;
26     $expect =~ s/\[PERLADMIN\]/$Config::Config{perladmin}/;
27
28     # result
29     open my $in, $outfile or die "cannot open $outfile: $!";
30     my $result = <$in>;
31     close $in;
32
33     is($expect, $result, $testname);
34
35 }
36
37 1;