php/php-langspec

Tests are php.net implementation specific

cmb69 opened this issue · 0 comments

cmb69 commented

See, for instance, list_007.phpt:

--TEST--
Using lambda with list()
--FILE--
<?php
list($x, $y) = function() { };
var_dump($x, $y);
?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot use object of type Closure as array in %slist_007.php:3
Stack trace:
#0 {main}
thrown in %slist_007.php on line 3

The test obviously expects a certain error message including a certain message and stack trace format, although the spec merely mentions:

the right-hand operand must be an expression that designates an array or object implementing the ArrayAccess interface

Furthermore, the test uses var_dump which is only mentioned, but not specified in the langspec (particularly it's output format may differ).

If the tests should be useful for language implementations other than the php.net implementation, they should be written with portability in mind. Otherwise we could as well get rid of the test suite altogether (and merge possibly missing tests to the php.net test suite).