summaryrefslogtreecommitdiff
path: root/run-tests.php
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-08-09 11:57:02 (GMT)
committerMarcus Boerger <helly@php.net>2003-08-09 11:57:02 (GMT)
commitfe37ce8f66c72f6a18b82390057a3a34ed1bce4b (patch)
tree56469fcb5afdf38296e10122fd8baed3766a2d6e /run-tests.php
parente491d75df3a2455506fc00af0eb3e80240d6a43f (diff)
downloadphp-fe37ce8f66c72f6a18b82390057a3a34ed1bce4b.tar.gz
Don't show matching regex as different
Diffstat (limited to 'run-tests.php')
-rwxr-xr-xrun-tests.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/run-tests.php b/run-tests.php
index 69347c9..394601b 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -851,7 +851,7 @@ COMMAND $cmd
} else {
$wanted = trim($section_text['EXPECT']);
$wanted = preg_replace('/\r\n/',"\n",$wanted);
- // compare and leave on success
+ // compare and leave on success
$ok = (0 == strcmp($output,$wanted));
if ($ok) {
@unlink($tmp_file);
@@ -861,6 +861,7 @@ COMMAND $cmd
}
return 'PASSED';
}
+ $wanted_re = NULL;
}
// Test failed so we need to report details.
@@ -898,7 +899,7 @@ COMMAND $cmd
if (strpos($log_format,'D') !== FALSE) {
$logname = ereg_replace('\.phpt$','.diff',$file);
$log = fopen($logname,'w') or error("Cannot create test log - $logname");
- fwrite($log,generate_diff($wanted,$output));
+ fwrite($log,generate_diff($wanted,$wanted_re,$output));
fclose($log);
}
@@ -924,10 +925,18 @@ $output
return $warn ? 'WARNED' : 'FAILED';
}
-function generate_diff($wanted,$output)
+function generate_diff($wanted,$wanted_re,$output)
{
$w = explode("\n", $wanted);
$o = explode("\n", $output);
+ if (!is_null($wanted_re)) {
+ $r = explode("\n", $wanted_re);
+ for($idx = 0; $idx < min(count($o),count($r)); $idx++) {
+ if (preg_match('/^'.$r[$idx].'$/s', $o[$idx])) {
+ $w[$idx] = $o[$idx];
+ }
+ }
+ }
$w1 = array_diff_assoc($w,$o);
$o1 = array_diff_assoc($o,$w);
$w2 = array();