This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[tests for Pod::Html]
[perl5.git] / lib / Pod / t / pod2html-lib.pl
CommitLineData
78343be7
SB
1require Cwd;
2require Pod::Html;
3require Config;
4use File::Spec::Functions;
5
6sub 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
371;