sniper Wed Dec 7 06:12:52 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src run-tests.php
Log:
MFH: fixed wrong logic
http://cvs.php.net/diff.php/php-src/run-tests.php?r1=1.226.2.6&r2=1.226.2.7&ty=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.226.2.6 php-src/run-tests.php:1.226.2.7
--- php-src/run-tests.php:1.226.2.6 Wed Dec 7 05:08:42 2005
+++ php-src/run-tests.php Wed Dec 7 06:12:52 2005
@@ -23,7 +23,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: run-tests.php,v 1.226.2.6 2005/12/07 10:08:42 sniper Exp $ */
+/* $Id: run-tests.php,v 1.226.2.7 2005/12/07 11:12:52 sniper Exp $ */
/* Sanity check to ensure that pcre extension needed by this script is
available.
* In the event it is not, print a nice error message indicating that this
script will
@@ -318,7 +318,7 @@
$html_output = is_resource($html_file);
break;
case '--version':
- echo "$Id: run-tests.php,v 1.226.2.6
2005/12/07 10:08:42 sniper Exp $\n";
+ echo "$Id: run-tests.php,v 1.226.2.7
2005/12/07 11:12:52 sniper Exp $\n";
exit(1);
default:
echo "Illegal switch specified!\n";
@@ -690,11 +690,13 @@
// Write the given text to a temporary file, and return the filename.
//
-function save_text($filename,$text)
+function save_text($filename, $text)
{
global $DETAILED;
- @file_put_contents($filename, $text) or error("Cannot open file '" .
$filename . "' (save_text)");
+ if (@file_put_contents($filename, $text) === FALSE) {
+ error("Cannot open file '" . $filename . "' (save_text)");
+ }
if (1 < $DETAILED) echo "
FILE $filename {{{
$text
@@ -706,7 +708,7 @@
// Write an error in a format recognizable to Emacs or MSVC.
//
-function error_report($testname,$logname,$tested)
+function error_report($testname, $logname, $tested)
{
$testname = realpath($testname);
$logname = realpath($logname);
@@ -1218,30 +1220,30 @@
if (!$passed) {
// write .exp
- if (strpos($log_format,'E') !== FALSE) {
- file_put_contents($exp_filename, $wanted) or
error("Cannot create expected test output - $exp_filename");
+ if (strpos($log_format,'E') !== FALSE &&
file_put_contents($exp_filename, $wanted) === FALSE) {
+ error("Cannot create expected test output -
$exp_filename");
}
// write .out
- if (strpos($log_format,'O') !== FALSE) {
- file_put_contents($output_filename, $output) or
error("Cannot create test output - $output_filename");
+ if (strpos($log_format,'O') !== FALSE &&
file_put_contents($output_filename, $output) === FALSE) {
+ error("Cannot create test output - $output_filename");
}
// write .diff
- if (strpos($log_format,'D') !== FALSE) {
- file_put_contents($diff_filename,
generate_diff($wanted,$wanted_re,$output)) or error("Cannot create test diff -
$diff_filename");
+ if (strpos($log_format,'D') !== FALSE &&
file_put_contents($diff_filename, generate_diff($wanted,$wanted_re,$output))
=== FALSE) {
+ error("Cannot create test diff - $diff_filename");
}
// write .log
- if (strpos($log_format,'L') !== FALSE) {
- file_put_contents($log_filename, "
+ if (strpos($log_format,'L') !== FALSE &&
file_put_contents($log_filename, "
---- EXPECTED OUTPUT
$wanted
---- ACTUAL OUTPUT
$output
---- FAILED
-") or error("Cannot create test log - $log_filename");
- error_report($file,$log_filename,$tested);
+") === FALSE) {
+ error("Cannot create test log - $log_filename");
+ error_report($file, $log_filename, $tested);
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php