From: Nuno Lopes Date: Mon, 17 Mar 2008 17:18:19 +0000 (+0000) Subject: detect test cases with duplicated sections X-Git-Tag: BEFORE_NEW_PARAMETER_PARSE~561 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95b627f29b831d3ea9e9cc8bb12425649d6a6506;p=php detect test cases with duplicated sections --- diff --git a/run-tests.php b/run-tests.php index 9490406913..63893eee2c 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1032,16 +1032,7 @@ TEST $file "; // Load the sections of the test file. - $section_text = array( - 'TEST' => '', - 'SKIPIF' => '', - 'GET' => '', - 'COOKIE' => '', - 'POST_RAW' => '', - 'POST' => '', - 'UPLOAD' => '', - 'ARGS' => '', - ); + $section_text = array('TEST' => ''); $fp = fopen($file, "rt") or error("Cannot open test file: $file"); @@ -1066,6 +1057,12 @@ TEST $file // Match the beginning of a section. if (preg_match('/^--([_A-Z]+)--/', $line, $r)) { $section = $r[1]; + + if (isset($section_text[$section])) { + $bork_info = "duplicated $section section"; + $borked = true; + } + $section_text[$section] = ''; $secfile = $section == 'FILE' || $section == 'FILEEOF' || $section == 'FILE_EXTERNAL'; $secdone = false; @@ -1392,7 +1389,7 @@ TEST $file $env['HTTP_COOKIE'] = ''; } - $args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS'] : ''; + $args = isset($section_text['ARGS']) ? ' -- '.$section_text['ARGS'] : ''; if (array_key_exists('POST_RAW', $section_text) && !empty($section_text['POST_RAW'])) { $post = trim($section_text['POST_RAW']);