#!/usr/bin/perl
my $state = 'skipping';
+my $error_count = 0;
if ($0 =~ /html/) {
print "<html><head><title>test output</title>";
print "<link rel='stylesheet' type='text/css' href='test_output.css'>";
- print "</head><body><pre>\n";
+ print "</head><body><a href='#error'>Jump to first error</a><pre>\n";
}
while (my $line = <>) {
|| $line =~ /\. not ok/
) {
$class .= 'notok ';
+ $error_count++;
}
$class .= 'result ' if ($line =~ /^Result:/);
$class .= 'pass ' if ($line =~ /^Result: PASS/);
- $class .= 'fail ' if ($line =~ /^Result: FAIL/);
+ if ($line =~ /^Result: FAIL/) {
+ $class .= 'fail ';
+ $error_count++;
+ }
if ($line =~ /^#/
|| $line =~ /Checks:/
|| $line =~ /_\.-~=/
$class .= 'comment ';
}
chomp $line;
- print "<span class='$class'>$line</span>\n";
+ my $html_line = "<span class='$class'>$line</span>";
+ if ($error_count == 1) {
+ print "<a name='error'>$html_line</a>\n";
+ } else {
+ print "$html_line\n";
+ }
} else {
print $line;
}