Req #55736 [Opn]: Added EXPECT_EXTERNAL section to run-tests.php
| From: | tim at digicol dot de | Date: | Tue, 20 Sep 2011 09:31:44 +0000 |
| Subject: | Req #55736 [Opn]: Added EXPECT_EXTERNAL section to run-tests.php | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-163708@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55736&edit=1
ID: 55736
User updated by: tim at digicol dot de
Reported by: tim at digicol dot de
-Summary: Added FILE_EXTERNAL section to run-tests.php
+Summary: Added EXPECT_EXTERNAL section to run-tests.php
Status: Open
Type: Feature/Change Request
Package: *General Issues
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
Sorry, typo in summary. It's EXPECT_EXTERNAL, not FILE_EXTERNAL.
Previous Comments:
------------------------------------------------------------------------
[2011-09-20 09:21:53] tim at digicol dot de
Description:
------------
In the .phpt files used with run-tests.php, I'd like an option to read the
expected output from external files.
For consistency with the FILE / FILE_EXTERNAL section naming, I'd call this
feature EXPECT_EXTERNAL.
The attached patch (against run-tests.php of PHP 5.3.8) implements this
functionality. Would you mind adding it as a standard feature?
Reason: We often expect relatively large XML output from our tests. Having to
paste it into the EXPECT section makes the .phpt file large, and the XML is
easier to handle in a separate file (I can run xmllint on it). Also, I'd like to
reuse one test's expected output as the input for another test, which works great
with external files.
Test script:
---------------
[digicol@dcxcentosvmware php-5.3.8]$ cat tmp.phpt
--TEST--
Demo
--FILE--
<?php
echo pi() . "\n";
?>
--EXPECT_EXTERNAL--
expected.txt
[digicol@dcxcentosvmware php-5.3.8]$ cat expected.txt
3.1415926535898
[digicol@dcxcentosvmware php-5.3.8]$ php run-tests.php.expect_external -p
which php
tmp.phpt
=====================================================================
PHP : /usr/local/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.3.4
ZEND_VERSION: 2.3.0
PHP_OS : Linux - Linux dcxcentosvmware.digicol.local 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9
12:54:20 EST 2010 x86_64
INI actual : /usr/local/lib/php.ini
More .INIs :
CWD : /usr/local/src/php-5.3.8
Extra dirs :
VALGRIND : Not used
=====================================================================
Running selected tests.
PASS Demo [tmp.phpt]
=====================================================================
Number of tests : 1 1
Tests skipped : 0 ( 0.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 0 ( 0.0%) ( 0.0%)
Expected fail : 0 ( 0.0%) ( 0.0%)
Tests passed : 1 (100.0%) (100.0%)
---------------------------------------------------------------------
Time taken : 0 seconds
=====================================================================
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55736&edit=1