summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quilt.changes5
-rwxr-xr-xtest/run25
2 files changed, 21 insertions, 9 deletions
diff --git a/quilt.changes b/quilt.changes
index 978a0d8..9d84da8 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Sat Jan 21 21:32:59 CET 2006 - agruen@suse.de
+
+- test/run: Support regex matching in test scripts.
+
+-------------------------------------------------------------------
Sat Jan 21 21:31:16 CET 2006 - jayvdb@gmail.com
- Check whether cp -l works.
diff --git a/test/run b/test/run
index 695a125..a4c6951 100755
--- a/test/run
+++ b/test/run
@@ -87,18 +87,27 @@ sub process_test($$$$) {
print "[$prog_line] \$ ", join(' ',
map { s/\s/\\$&/g; $_ } @$p), " -- ";
my $result = exec_test($prog, $in);
- my $good = 1;
+ my @good = ();
+ my $good;
my $nmax = (@$out > @$result) ? @$out : @$result;
for (my $n=0; $n < $nmax; $n++) {
- if (!defined($out->[$n]) || !defined($result->[$n]) ||
- $out->[$n] ne $result->[$n]) {
- $good = 0;
- }
+ my $use_re = ($out->[$n] =~ /^~ /);
+ $out->[$n] =~ s/^~ //g;
+
+ if (!defined($out->[$n]) || !defined($result->[$n]) ||
+ (!$use_re && $result->[$n] ne $out->[$n]) ||
+ ( $use_re && $result->[$n] !~ /^$out->[$n]/)) {
+ push @good, ($use_re ? '!~' : '!=');
+ }
+ else {
+ push @good, ($use_re ? '=~' : '==');
+ }
}
+ my $good = !(grep /!/, @good);
$tests++;
$failed++ unless $good;
print $good ? $OK : $FAILED, "\n";
- if (!$good) {
+ if (!$good || $opt_v) {
for (my $n=0; $n < $nmax; $n++) {
my $l = defined($out->[$n]) ? $out->[$n] : "~";
chomp $l;
@@ -106,10 +115,8 @@ sub process_test($$$$) {
chomp $r;
print sprintf("%-" . ($width-3) .
"s %s %-" . ($width-1) .
- "s\n", $l, $l eq $r ? '|' : '?', $r);
+ "s\n", $r, $good[$n], $l);
}
- } elsif ($opt_v) {
- print join('', @$result);
}
}