diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/strings/strspn_error.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/strings/strspn_error.phpt')
-rw-r--r-- | ext/standard/tests/strings/strspn_error.phpt | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/ext/standard/tests/strings/strspn_error.phpt b/ext/standard/tests/strings/strspn_error.phpt new file mode 100644 index 0000000..caa1f90 --- /dev/null +++ b/ext/standard/tests/strings/strspn_error.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test strspn() function : error conditions +--FILE-- +<?php +/* Prototype : proto int strspn(string str, string mask [, int start [, int len]]) + * Description: Finds length of initial segment consisting entirely of characters found in mask. + If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) + * Source code: ext/standard/string.c + * Alias to functions: none +*/ + +/* +* Test strspn() : for error conditons +*/ + +echo "*** Testing strspn() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing strspn() function with Zero arguments --\n"; +var_dump( strspn() ); + +//Test strspn with one more than the expected number of arguments +echo "\n-- Testing strspn() function with more than expected no. of arguments --\n"; +$str = 'string_val'; +$mask = 'string_val'; +$start = 2; +$len = 20; + + +$extra_arg = 10; +var_dump( strspn($str,$mask,$start,$len, $extra_arg) ); + +// Testing strspn withone less than the expected number of arguments +echo "\n-- Testing strspn() function with less than expected no. of arguments --\n"; +$str = 'string_val'; +var_dump( strspn($str) ); + +echo "Done" +?> +--EXPECTF-- +*** Testing strspn() : error conditions *** + +-- Testing strspn() function with Zero arguments -- + +Warning: strspn() expects at least 2 parameters, 0 given in %s on line %d +NULL + +-- Testing strspn() function with more than expected no. of arguments -- + +Warning: strspn() expects at most 4 parameters, 5 given in %s on line %d +NULL + +-- Testing strspn() function with less than expected no. of arguments -- + +Warning: strspn() expects at least 2 parameters, 1 given in %s on line %d +NULL +Done |