Re: PHPT and --FILEEOF--
| From: | Greg Beaver | Date: | Thu, 30 Apr 2009 13:55:35 +0000 |
| Subject: | Re: PHPT and --FILEEOF-- | ||
| References: | 1 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-64832@lists.php.net to get a copy of this message | ||
Eric Stewart wrote:
> I've been doing some research for a new document which details all sections
> of the PHPT file layout. It includes a description, any requirements,
> whether it's a required section, format and diverse examples for each and
> every section.
>
> When I ran into --FILEEOF--, I hit a wall. None of the descriptions I've
> found point to any real world usages. I then search all the PHPTs and only
> found 2 instances of it's usage in current use:
> /tests/lang/bug35382.phpt
> /tests/lang/comments2.phpt
>
> The reason for using --FILEEOF-- in either of these tests wasn't apparent to
> me. So I ran both tests and they both passed. But then I modified them
> swapping out the --FILEEOF-- for --FILE-- and reran the tests. Both passed
> again. This unfortunately leads me to believe that even these two tests
> don't present any real world reason for this construct.
>
> So I'm a little unsure what the use case for --FILEEOF-- is. Can anyone help
> me out?
Hi Eric,
When in doubt, refer to the source of run-tests.php and its commit
history. The big hint here is that FILEEOF replaces \r and \n with ''
helly added it to test for bug #35382 (which I found by searching the
commit log at cvs.php.net first for FILEEOF and then for 35382):
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.237&r2=1.238
It looks like at the time, the test would pass when it should fail if
the comment line ended with \n or with \r or with \r\n. The same is
true of the comments2.phpt test - the problem being tested for is the
lexer failing when there is nothing after the closing bracket }.
a test that should show the difference (which, ironically, I have not
tested :)
--TEST--
FILEEOF test
--FILEEOF--
hi
there
people
--EXPECT--
hitherepeople
Greg