Annotation of embedaddon/php/ext/ereg/tests/ereg_error_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test ereg() function : error conditions - wrong number of args
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : proto int ereg(string pattern, string string [, array registers])
! 6: * Description: Regular expression match
! 7: * Source code: ext/standard/reg.c
! 8: * Alias to functions:
! 9: */
! 10:
! 11: /*
! 12: * Test wrong number of args
! 13: */
! 14:
! 15: echo "*** Testing ereg() : error conditions ***\n";
! 16:
! 17:
! 18: //Test ereg with one more than the expected number of arguments
! 19: echo "\n-- Testing ereg() function with more than expected no. of arguments --\n";
! 20: $pattern = 'string_val';
! 21: $string = 'string_val';
! 22: $registers = array(1, 2);
! 23: $extra_arg = 10;
! 24: var_dump( ereg($pattern, $string, $registers, $extra_arg) );
! 25:
! 26: // Testing ereg with one less than the expected number of arguments
! 27: echo "\n-- Testing ereg() function with less than expected no. of arguments --\n";
! 28: $pattern = 'string_val';
! 29: var_dump( ereg($pattern) );
! 30:
! 31: echo "Done";
! 32: ?>
! 33: --EXPECTF--
! 34: *** Testing ereg() : error conditions ***
! 35:
! 36: -- Testing ereg() function with more than expected no. of arguments --
! 37:
! 38: Deprecated: Function ereg() is deprecated in %s on line %d
! 39:
! 40: Warning: ereg() expects at most 3 parameters, 4 given in %s on line %d
! 41: NULL
! 42:
! 43: -- Testing ereg() function with less than expected no. of arguments --
! 44:
! 45: Deprecated: Function ereg() is deprecated in %s on line %d
! 46:
! 47: Warning: ereg() expects at least 2 parameters, 1 given in %s on line %d
! 48: NULL
! 49: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>