From ed0b0d1f3392009bf823d65095a418af28bb0ecc Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Thu, 1 Dec 2005 00:57:29 +0000 Subject: [PATCH] - White space fixes --- run-tests.php | 92 +++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/run-tests.php b/run-tests.php index c237b44d3c..996eef5dfa 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1135,63 +1135,63 @@ COMMAND $cmd } else { // normal testing - // Does the output match what is expected? - $output = trim($out); - $output = preg_replace('/\r\n/',"\n",$output); + // Does the output match what is expected? + $output = trim($out); + $output = preg_replace('/\r\n/',"\n",$output); - /* when using CGI, strip the headers from the output */ - if (isset($old_php) && ($pos = strpos($output, "\n\n")) !== FALSE) { - $output = substr($output, ($pos + 2)); - } - - if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) { - if (isset($section_text['EXPECTF'])) { - $wanted = trim($section_text['EXPECTF']); - } else { - $wanted = trim($section_text['EXPECTREGEX']); - } - $wanted_re = preg_replace('/\r\n/',"\n",$wanted); - if (isset($section_text['EXPECTF'])) { - $wanted_re = preg_quote($wanted_re, '/'); - // Stick to basics - $wanted_re = str_replace("%e", '\\' . DIRECTORY_SEPARATOR, $wanted_re); - $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy - $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re); - $wanted_re = str_replace("%d", "[0-9]+", $wanted_re); - $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re); - $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re); - $wanted_re = str_replace("%c", ".", $wanted_re); - // %f allows two points "-.0.0" but that is the best *simple* expression + /* when using CGI, strip the headers from the output */ + if (isset($old_php) && ($pos = strpos($output, "\n\n")) !== FALSE) { + $output = substr($output, ($pos + 2)); } + + if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) { + if (isset($section_text['EXPECTF'])) { + $wanted = trim($section_text['EXPECTF']); + } else { + $wanted = trim($section_text['EXPECTREGEX']); + } + $wanted_re = preg_replace('/\r\n/',"\n",$wanted); + if (isset($section_text['EXPECTF'])) { + $wanted_re = preg_quote($wanted_re, '/'); + // Stick to basics + $wanted_re = str_replace("%e", '\\' . DIRECTORY_SEPARATOR, $wanted_re); + $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy + $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re); + $wanted_re = str_replace("%d", "[0-9]+", $wanted_re); + $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re); + $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re); + $wanted_re = str_replace("%c", ".", $wanted_re); + // %f allows two points "-.0.0" but that is the best *simple* expression + } /* DEBUG YOUR REGEX HERE var_dump($wanted_re); print(str_repeat('=', 80) . "\n"); var_dump($output); */ - if (preg_match("/^$wanted_re\$/s", $output)) { - @unlink($tmp_file); - show_result("PASS", $tested, $file); - if (isset($old_php)) { - $php = $old_php; + if (preg_match("/^$wanted_re\$/s", $output)) { + @unlink($tmp_file); + show_result("PASS", $tested, $file); + if (isset($old_php)) { + $php = $old_php; + } + return 'PASSED'; } - return 'PASSED'; - } - } else { - $wanted = trim($section_text['EXPECT']); - $wanted = preg_replace('/\r\n/',"\n",$wanted); - // compare and leave on success - $ok = (0 == strcmp($output,$wanted)); - if ($ok) { - @unlink($tmp_file); - show_result("PASS", $tested, $file); - if (isset($old_php)) { - $php = $old_php; + } else { + $wanted = trim($section_text['EXPECT']); + $wanted = preg_replace('/\r\n/',"\n",$wanted); + // compare and leave on success + $ok = (0 == strcmp($output,$wanted)); + if ($ok) { + @unlink($tmp_file); + show_result("PASS", $tested, $file); + if (isset($old_php)) { + $php = $old_php; + } + return 'PASSED'; } - return 'PASSED'; + $wanted_re = NULL; } - $wanted_re = NULL; - } } //end of non-valgrind testing -- 2.40.0