cvs: phpruntests /src/testcase rtTestDifference.php
| From: | Zoe Slattery | Date: | Fri, 05 Jun 2009 09:30:19 +0000 |
| Subject: | cvs: phpruntests /src/testcase rtTestDifference.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-58517@lists.php.net to get a copy of this message | ||
zoe Fri Jun 5 09:30:19 2009 UTC
Modified files:
/phpruntests/src/testcase rtTestDifference.php
Log:
Fixing a bug in the differencing code
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/rtTestDifference.php?r1=1.4&r2=1.5&diff_format=u
Index: phpruntests/src/testcase/rtTestDifference.php
diff -u phpruntests/src/testcase/rtTestDifference.php:1.4
phpruntests/src/testcase/rtTestDifference.php:1.5
--- phpruntests/src/testcase/rtTestDifference.php:1.4 Mon May 25 12:46:57 2009
+++ phpruntests/src/testcase/rtTestDifference.php Fri Jun 5 09:30:19 2009
@@ -22,16 +22,23 @@
public function __construct(rtOutputSection $expectedOutput, $output)
{
- $this->expectedOutput = $expectedOutput->getContents();
+
+ $this->expectedOutput = $expectedOutput->getContents();
+
+ //Expect a regular expression from EXPECTF or EXPECTREGEX but not from EXPECT sections
+ $is_reg = true;
+ if(get_class($expectedOutput) == 'rtExpectSection') {
+ $is_reg = false;
+ }
$this->expectedRegularExpression = explode(b"\n",
$expectedOutput->getPattern());
$this->output = explode(b"\n", $output);
- $this->generateDiff();
+ $this->generateDiff($is_reg);
}
- public function generateDiff()
+ public function generateDiff($is_reg)
{
- $this->difference = $this->generateArrayDiff($this->expectedRegularExpression,
$this->output, true, $this->expectedOutput);
+ $this->difference = $this->generateArrayDiff($this->expectedRegularExpression,
$this->output, $is_reg, $this->expectedOutput);
}
/**
@@ -55,6 +62,14 @@
*/
public function generateArrayDiff($ar1, $ar2, $is_reg, $w)
{
+ var_dump($is_reg);
+
+ file_put_contents("/home/zoe/bug/ar1_my.out", $ar1);
+ file_put_contents("/home/zoe/bug/ar2_my.out", $ar2);
+ file_put_contents("/home/zoe/bug/w_my.out", $w);
+
+
+
$idx1 = 0; $ofs1 = 0; $cnt1 = @count($ar1);
$idx2 = 0; $ofs2 = 0; $cnt2 = @count($ar2);
$diff = array();
@@ -189,6 +204,8 @@
public function compLine($l1, $l2, $is_reg)
{
if ($is_reg) {
+ /* var_dump($l1);
+ var_dump($l2);*/
return preg_match((binary) "/^$l1$/s", (binary) $l2);
} else {
return !strcmp((binary) $l1, (binary) $l2);