Re: UEXPECTF is gone: any way to write "portable" tests?

From: Date: Wed, 23 Jul 2008 12:14:55 +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-64391@lists.php.net to get a copy of this message
Hi Ulf, Am Dienstag, den 22.07.2008, 22:00 +0200 schrieb Ulf Wendel: [...] > 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) While I think UEXPECT is a good idea, I'm not sure if it is really needed. From my experience, the problem is always about "string" or "unicode". So why not invent a placeholder which basically says "string" in < 6, "unicode" in >=6. Something like %string/unicode% ("it must be a string in <6 and unicode in >=6) and %string/binary% ("it must be a string in <6 and binary in >=6"). So your assertion would look like that: %string/unicode%(3) "PHP" This would mean less duplication of expected test output and therefore easier readable (and maintainable) tests. cu, Lars

Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc
« previous php.qa (#64391) next »