summaryrefslogtreecommitdiff
path: root/lib/Pod/t/pod2html-lib.pl
blob: b44a3aac0a5746293d2694a04015ecff874d7263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require Cwd;
require Pod::Html;
require Config;
use File::Spec::Functions;

sub convert_n_test {
    my($podfile, $testname) = @_;

    my $cwd = Cwd::cwd();
    my $new_dir = catdir $cwd, "..", "lib", "Pod", "t";
    my $infile  = catfile $new_dir, "$podfile.pod";
    my $outfile = catfile $new_dir, "$podfile.html";

    Pod::Html::pod2html(
        "--podpath=pod2html",
        "--podroot=$cwd",
        "--htmlroot=/",
        "--infile=$infile",
        "--outfile=$outfile"
    );


    local $/;
    # expected
    my $expect = <DATA>;
    $expect =~ s/\[PERLADMIN\]/$Config::Config{perladmin}/;

    # result
    open my $in, $outfile or die "cannot open $outfile: $!";
    my $result = <$in>;
    close $in;

    is($expect, $result, $testname);

}

1;