package TestPodIncPlainText;
BEGIN {
push @INC, '..';
require "testcmp.pl";
import TestCompare;
}
#use strict;
#use diagnostics;
use Carp;
use Exporter;
#use File::Compare;
#use Cwd qw(abs_path);
$MYPKG = eval { (caller)[0] };
@EXPORT = qw(&testpodplaintext);
BEGIN {
}
## Hardcode settings for TERMCAP and COLUMNS so we can try to get
## reproducible results between environments
$INSTDIR =~ s#/$## if $^O eq 'VMS';
$INSTDIR =~ s#:$## if $^O eq 'MacOS';
$INSTDIR =~ s#:$## if $^O eq 'MacOS';
);
## Find the path to the file to =include
sub findinclude {
my $self = shift;
my $incname = shift;
## Need to search for it. Look in the following directories ...
## 1. the directory containing this pod file
## 2. the parent directory of the above
for (@podincdirs) {
}
warn("*** Can't find =include file $incname in @podincdirs\n");
return "";
}
sub command {
my $self = shift;
local $_ = $text || '';
## Defer to the superclass for everything except '=include'
## We have an '=include' command
my @incargs = split;
if (@incargs == 0) {
warn("*** No filename given for '=include'\n");
return;
}
}
sub begin_input {
}
sub podinc2plaintext( $ $ ) {
local $_;
my $text_parser = $MYPKG->new;
}
sub testpodinc2plaintext( @ ) {
my %args = @_;
my $different = '';
unless (-e $cmpfile) {
my $msg = "*** Can't find comparison file $cmpfile for testing $infile";
warn "$msg\n";
return $msg;
}
print "# Running testpodinc2plaintext for '$testname'...\n";
## Compare the output against the expected result
$different = "$outfile is different from $cmpfile";
}
else {
unlink($outfile);
}
return $different;
}
sub testpodplaintext( @ ) {
my @testpods = @_;
my $passes = 0;
my $failed = 0;
local $_;
$testdir ||= $_;
$testname =~ s/\.t$//;
if ($opts{'-xrgen'}) {
## Create the comparison file
print "# Creating expected result for \"$testname\"" .
" pod2plaintext test ...\n";
}
else {
print "# File $cmpfile already exists" .
" (use '-force' to regenerate it).\n";
}
next;
}
my $failmsg = testpodinc2plaintext
if ($failmsg) {
++$failed;
print "#\tFAILED. ($failmsg)\n";
}
else {
++$passes;
unlink($outfile);
print "#\tPASSED.\n";
}
}
return $passes;
}
1;