BEGIN { $| = 1; print "1..5\n"; }
END {print "not ok 1\n" unless $loaded;}
use Razor2::Preproc::deHTMLxs;
$loaded = 1;
print "ok 1\n";
my $dh = new Razor2::Preproc::deHTMLxs;
print "NOT " unless $dh->is_xs;
print "ok 2\n";
my $debug=0;
my $hdr = "X-Razor2-Dummy: foo\n\n";
my $testnum = 3;
foreach my $html_fn (qw(
html.1 html.2 html.3
)) {
my $fn = "testit/$html_fn";
open(IN, "$fn") or die "cant read $fn";
my $html = $hdr . join '', <IN>;
close IN;
if ($dh->isit(\$html)) {
my $cleaned = $html;
$dh->doit(\$cleaned);
$cleaned =~ s/^$hdr//s;
print "html: $fn (len=". length($html) .") cleaned len=". length($cleaned) ."\n" if $debug;
if ( $^O eq 'VMS' ) {open(IN, "${fn}_deHTMLxs") or die "cant read ${fn}_deHTMLxs";}
if ( $^O ne 'VMS' ) {open(IN, "$fn.deHTMLxs") or die "cant read $fn.deHTMLxs";}
my $dehtml = join '', <IN>;
close IN;
if ($cleaned eq $dehtml) {
print " -- YEAH -- cleaned html is same as .deHTMLxs: $fn\n" if $debug;
} else {
print "NOT ";
print "cleaned html (len=". length($cleaned) .") differs from .deHTMLxs (len=".
length($dehtml) .")\n" if $debug;
}
} else {
print "not html: $fn (len=". length($html) .")\n" if $debug;
print "NOT ";
}
print "ok ". $testnum++ ."\n";
}