Commit:    5ffaf95d3f6d8634cdc218ea6bfdb24c7887148c
Author:    Tim Strehle <t...@strehle.de>         Tue, 3 Sep 2013 14:38:52 +0200
Parents:   04fcf6a98b8901ae7c442aa92368c82fa7bd671d
Branches:  master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=5ffaf95d3f6d8634cdc218ea6bfdb24c7887148c

Log:
run-tests.php: Adding support for sections EXPECT_EXTERNAL, EXPECTF_EXTERNAL 
and EXPECTREGEX_EXTERNAL. (Issue 55736)

Changed paths:
  M  run-tests.php
  A  tests/run-test/test011.phpt
  A  tests/run-test/test011.txt
  A  tests/run-test/test012.phpt
  A  tests/run-test/test012.txt
  A  tests/run-test/test013.phpt
  A  tests/run-test/test013.txt


Diff:
diff --git a/run-tests.php b/run-tests.php
index 54a12a1..dc88ddf 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -1289,16 +1289,20 @@ TEST $file
                                unset($section_text['FILEEOF']);
                        }
 
-                       if (@count($section_text['FILE_EXTERNAL']) == 1) {
-                               // don't allow tests to retrieve files from 
anywhere but this subdirectory
-                               $section_text['FILE_EXTERNAL'] = dirname($file) 
. '/' . trim(str_replace('..', '', $section_text['FILE_EXTERNAL']));
+                       foreach (array( 'FILE', 'EXPECT', 'EXPECTF', 
'EXPECTREGEX' ) as $prefix) {            
+                               $key = $prefix . '_EXTERNAL';
 
-                               if 
(file_exists($section_text['FILE_EXTERNAL'])) {
-                                       $section_text['FILE'] = 
file_get_contents($section_text['FILE_EXTERNAL'], FILE_BINARY);
-                                       unset($section_text['FILE_EXTERNAL']);
-                               } else {
-                                       $bork_info = "could not load 
--FILE_EXTERNAL-- " . dirname($file) . '/' . 
trim($section_text['FILE_EXTERNAL']);
-                                       $borked = true;
+                               if (@count($section_text[$key]) == 1) {
+                                       // don't allow tests to retrieve files 
from anywhere but this subdirectory
+                                       $section_text[$key] = dirname($file) . 
'/' . trim(str_replace('..', '', $section_text[$key]));
+
+                                       if (file_exists($section_text[$key])) {
+                                               $section_text[$prefix] = 
file_get_contents($section_text[$key], FILE_BINARY);
+                                               unset($section_text[$key]);
+                                       } else {
+                                               $bork_info = "could not load 
--" . $key . "-- " . dirname($file) . '/' . trim($section_text[$key]);
+                                               $borked = true;
+                                       }
                                }
                        }
 
diff --git a/tests/run-test/test011.phpt b/tests/run-test/test011.phpt
new file mode 100644
index 0000000..17f1f7a
--- /dev/null
+++ b/tests/run-test/test011.phpt
@@ -0,0 +1,6 @@
+--TEST--
+EXPECT_EXTERNAL
+--FILE--
+abc
+--EXPECT_EXTERNAL--
+test011.txt
diff --git a/tests/run-test/test011.txt b/tests/run-test/test011.txt
new file mode 100644
index 0000000..8baef1b
--- /dev/null
+++ b/tests/run-test/test011.txt
@@ -0,0 +1 @@
+abc
diff --git a/tests/run-test/test012.phpt b/tests/run-test/test012.phpt
new file mode 100644
index 0000000..8213aa2
--- /dev/null
+++ b/tests/run-test/test012.phpt
@@ -0,0 +1,12 @@
+--TEST--
+EXPECTF_EXTERNAL
+--FILE--
+123
+-123
++123
++1.1
+abc
+0abc
+x
+--EXPECTF_EXTERNAL--
+test012.txt
diff --git a/tests/run-test/test012.txt b/tests/run-test/test012.txt
new file mode 100644
index 0000000..bb29321
--- /dev/null
+++ b/tests/run-test/test012.txt
@@ -0,0 +1,7 @@
+%d
+%i
+%i
+%f
+%s
+%x
+%c
diff --git a/tests/run-test/test013.phpt b/tests/run-test/test013.phpt
new file mode 100644
index 0000000..79ccd20
--- /dev/null
+++ b/tests/run-test/test013.phpt
@@ -0,0 +1,6 @@
+--TEST--
+EXPECTREGEX_EXTERNAL
+--FILE--
+abcde12314235xyz34264768286abcde
+--EXPECTREGEX_EXTERNAL--
+test013.txt
diff --git a/tests/run-test/test013.txt b/tests/run-test/test013.txt
new file mode 100644
index 0000000..6c280ec
--- /dev/null
+++ b/tests/run-test/test013.txt
@@ -0,0 +1 @@
+[abcde]+[0-5]*xyz[2-8]+abcde


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to