2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-03 02:40:53 +00:00

Update qtest to 1.8

Version 1.8 allows QTC::TC to break across lines.
This commit is contained in:
Jay Berkenbilt 2022-02-26 10:17:22 -05:00
parent 99393e6ab7
commit dffd30ccbd

View File

@ -33,7 +33,7 @@ require TestDriver;
if ((@ARGV == 1) && ($ARGV[0] eq '--version')) if ((@ARGV == 1) && ($ARGV[0] eq '--version'))
{ {
print "$whoami version 1.7\n"; print "$whoami version 1.8\n";
exit 0; exit 0;
} }
if ((@ARGV == 1) && ($ARGV[0] eq '--print-path')) if ((@ARGV == 1) && ($ARGV[0] eq '--print-path'))
@ -538,41 +538,45 @@ sub tc_do_initial_checks
my %seen_cases = (); my %seen_cases = ();
foreach my $src (@tc_srcs) foreach my $src (@tc_srcs)
{ {
my $s = new IO::File("<$src") or die "$whoami: open $src: $!\n"; local $/ = undef;
binmode $s; my $s = new IO::File("<$src") or die "$whoami: open $src: $!\n";
while (<$s>) binmode $s;
{ my $content = <$s>;
# Look for coverage calls in the source subject to certain $s->close();
# lexical constraints my @found = ();
my ($lscope, $case); # Look for coverage calls in the source subject to certain lexical
if (m/^\s*\&?(?:QTC|qtc)(?:::|\.)TC\(\"([^\"]+)\",\s*\"([^\"]+)\"/) # constraints. Count newlines in $` to get the line number.
{ while ($content =~
# C++, Java, Perl, etc. m/^\s*\&?(?:QTC|qtc)(?:::|\.)(?:TC|tc)\(\s*\"([^\"]+)\",\s*\"([^\"]+)\"/mg)
($lscope, $case) = ($1, $2); {
} # C++, Java, Perl, etc.
elsif (m/^[^\#]*\$\(call QTC.TC,([^,]+),([^,\)]+)/) push(@found, [$1, $2, 1+scalar(split('\n', $`))]);
{ }
# make while ($content =~ m/^[^\#\n]*\$\(call QTC.TC,([^,]+),([^,\)]+)/mg)
($lscope, $case) = ($1, $2); {
} # make
if ((defined $lscope) && (defined $case)) push(@found, [$1, $2, 1+scalar(split('\n', $`))]);
{ }
if ($lscope eq $tc_scope) foreach my $i (@found)
{ {
push(@{$seen_cases{$case}}, [$src, $.]); my ($lscope, $case, $line) = @$i;
} if ((defined $lscope) && (defined $case))
elsif (exists $tc_ignored_scopes{$lscope}) {
{ if ($lscope eq $tc_scope)
&QTC::TC("testdriver", "driver ignored scope"); {
} push(@{$seen_cases{$case}}, [$src, $line]);
else }
{ elsif (exists $tc_ignored_scopes{$lscope})
&QTC::TC("testdriver", "driver out-of-scope case"); {
error("$src:$.: out-of-scope coverage case"); &QTC::TC("testdriver", "driver ignored scope");
} }
} else
} {
$s->close(); &QTC::TC("testdriver", "driver out-of-scope case");
error("$src:$line: out-of-scope coverage case");
}
}
}
} }
my %wanted_cases = %tc_cases; my %wanted_cases = %tc_cases;