From dfb8b00838b720c256115231b4950dfa7b58742a Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Mon, 17 Mar 2008 17:20:27 +0000 Subject: [PATCH] MFB: detect duplicate sections --- run-tests.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/run-tests.php b/run-tests.php index 810974394a..b808409678 100755 --- a/run-tests.php +++ b/run-tests.php @@ -1053,16 +1053,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"); @@ -1087,6 +1078,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; @@ -1454,7 +1451,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']); -- 2.40.0