Re: UEXPECTF is gone: any way to write "portable" tests?
| From: | Felix De Vliegher | Date: | Tue, 22 Jul 2008 21:47:01 +0000 |
| Subject: | Re: UEXPECTF is gone: any way to write "portable" tests? | ||
| References: | 1 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-64388@lists.php.net to get a copy of this message | ||
Hi Ulf
+1 on this one. I once actually thought this was the expected behaviour of the UEXPECT(F) part :-)
Of all the tests I wrote that had a difference between PHP5 and PHP6, only one actually had more changes needed than just output related, so it would make work easier. The only drawback is that using the same name might confuse some people (but the name makes the most sense).
Felix
Op 22-jul-08, om 22:00 heeft Ulf Wendel het volgende geschreven:
Hi, as far as I know UEXPECT[F] is history. run-tests.php does not support it any more as PHP 6 always returns unicode strings and not binary strings. UEXPECT[F] has been introduced to handle the formerly two different run modes of PHP 6: unicode and non-unicode. However, I used it to write portable tests: tests that can be run with PHP 5 and PHP 6. PHP 5 (and PHP 6 when run in non-unicode mode) did check the EXPECT[F] sections and PHP 6 did check the UEXPECT[F] sections. One test file for both PHP 5 and PHP 6 - cool thing. mytest.phpt EXPECT[F] ---> PHP 5: string(3) "PHP" (= earlier PHP 6 non-unicode mode) UEXPECT[F] ---> PHP 6: unicode(3) "PHP" (= todays PHP 6 unicode only mode) Meanwhile UEXPECT[F] is gone. For every test that uses print_r()/var_dump() etc. we now need two copies of the test as the output of the test runs will differ: PHP 5 mytest.phpt EXPECT[F] string(3) "PHP" PHP 6 mytest.phpt EXPECT[F] unicode(3) "PHP" I wonder if it wouldn't be easier to have just one version of a test, one file. It seems that there's no way to write one test and I have to keep two only marginally different versions in sync. I'm asking because: nixnutz@ulflinux:~/php6> ls -la ext/mysql/tests/*.phpt ext/mysqli/tests/*.phpt ext/pdo_mysql/tests/*.phpt | wc -l 480 That's 480 * 2 = 960 files to keep in sync. And some of them do already have proper UEXPECT[F] sections: nixnutz@ulflinux:~/php6> ls -la ext/mysql/tests/*.phpt ext/mysqli/tests/*.phpt | wc -l 393 Any chance to make run-tests.php (HEAD) check if a UEXPECT[F] section is there and if so, let PHP 6 use UEXPECT[F] instead of EXPECT[F]? Such a change should not hurt any existing tests. But test writers would be given a tool to create "portable" tests that run with PHP 5 and PHP 6. This means maintaining just one file and not two. It makes "MFH" a thing you can do without turning your brain on. Ulf --PHP Quality Assurance Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php