Re: [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 $base_dir = catdir $cwd, "..", "lib", "Pod";
11     my $new_dir  = catdir $base_dir, "t";
12     my $infile   = catfile $new_dir, "$podfile.pod";
13     my $outfile  = catfile $new_dir, "$podfile.html";
14
15     Pod::Html::pod2html(
16         "--podpath=t",
17         "--podroot=$base_dir",
18         "--htmlroot=/",
19         "--infile=$infile",
20         "--outfile=$outfile"
21     );
22
23
24     local $/;
25     # expected
26     my $expect = <DATA>;
27     $expect =~ s/\[PERLADMIN\]/$Config::Config{perladmin}/;
28
29     # result
30     open my $in, $outfile or die "cannot open $outfile: $!";
31     my $result = <$in>;
32     close $in;
33
34     is($expect, $result, $testname);
35
36 }
37
38 1;