[ext/posix/tests/posix_strerror_error.phpt]
| From: | Eric Stewart | Date: | Fri, 02 May 2008 16:55:48 +0000 |
| Subject: | [ext/posix/tests/posix_strerror_error.phpt] | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-64273@lists.php.net to get a copy of this message | ||
The following is a patched version of the ext/posix/tests/posix_strerror_error.phpt test file.
A quick note to whoever reviews this test for commit: I replaced the %e in the second to last line of the expected output section to -999. As -999 is explicitly passed in it should be the only value passed out, not any possible digit. If you feel this is wrong, then the -999 can be replaced with %i which will also cause the test to pass.
This was not the only error in the test file, but it's the only one containing ambiguity.
--TEST--
Test posix_strerror() function : error conditions
--SKIPIF--
<?php
if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
?>
--FILE--
<?php
/* Prototype : proto string posix_strerror(int errno)
* Description: Retrieve the system error message associated with the given errno.
* Source code: ext/posix/posix.c
* Alias to functions:
*/
echo "*** Testing posix_strerror() : error conditions ***\n";
echo "\n-- Testing posix_strerror() function with Zero arguments --\n";
var_dump( posix_strerror() );
echo "\n-- Testing posix_strerror() function with more than expected no. of arguments --\n";
$errno = posix_get_last_error();
$extra_arg = 10;
var_dump( posix_strerror($errno, $extra_arg) );
echo "\n-- Testing posix_strerror() function with invalid error number --\n";
$errno = -999;
var_dump( posix_strerror($errno) );
echo "Done";
?>
--EXPECTF--
*** Testing posix_strerror() : error conditions ***
-- Testing posix_strerror() function with Zero arguments --
Warning: posix_strerror() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-- Testing posix_strerror() function with more than expected no. of arguments --
Warning: posix_strerror() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
-- Testing posix_strerror() function with invalid error number --
string(%d) "Unknown error: -999"
Done
Eric Stewart
e.stewart@mac.com