File: pod2usage.t

package info (click to toggle)
perl 5.42.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 128,392 kB
  • sloc: perl: 534,963; ansic: 240,563; sh: 72,042; pascal: 6,934; xml: 2,428; yacc: 1,360; makefile: 1,197; cpp: 208; lisp: 1
file content (41 lines) | stat: -rw-r--r-- 1,051 bytes parent folder | download
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
38
39
40
41
use strict;
use warnings;

use Test::More tests => 1;

use File::Basename;
use File::Spec;
use Cwd qw(abs_path);
my $THISDIR;
BEGIN {
    $THISDIR = dirname(abs_path(__FILE__));
    unshift @INC, $THISDIR;
    require "testcmp.pl";
    TestCompare->import;
}

use Pod::Text;

my $infile = File::Spec->catfile($THISDIR, (File::Spec->updir) x 2, 'scripts', 'pod2usage.PL');
my $cmpfile = File::Spec->catfile($THISDIR, 'pod2usage.xr');
my $outfile = File::Spec->catfile($THISDIR, 'pod2usage.OUT');

my $text_parser = Pod::Text->new;
$text_parser->parse_from_file($infile, $outfile);

my %opts = map +($_ => 1), @ARGV;

if ($opts{'-xrgen'}) {
    if ($opts{'-force'} or ! -e $cmpfile) {
        print "# Creating expected result for \"pod2usage\"" .
              " pod2text test ...\n";
        $text_parser->parse_from_file($infile, $cmpfile);
    }
    else {
        print "# File $cmpfile already exists" .
              " (use '-force' to regenerate it).\n";
    }
}

ok !testcmp( $outfile, $cmpfile ), "$outfile matches $cmpfile";
unlink $outfile;