]> granicus.if.org Git - php/commitdiff
detect test cases with duplicated sections
authorNuno Lopes <nlopess@php.net>
Mon, 17 Mar 2008 17:18:19 +0000 (17:18 +0000)
committerNuno Lopes <nlopess@php.net>
Mon, 17 Mar 2008 17:18:19 +0000 (17:18 +0000)
run-tests.php

index 9490406913122bc904dbf86997e73755ed4313a5..63893eee2c305fc91b3c2636f0459406afc7d26c 100755 (executable)
@@ -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']);