Annotation of embedaddon/php/ext/standard/tests/strings/strcspn_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test strcspn() function : error conditions 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : proto int strcspn(string str, string mask [, int start [, int len]])
                      6:  * Description: Finds length of initial segment consisting entirely of characters not found in mask.
                      7:                 If start or/and length is provided works like strcspn(substr($s,$start,$len),$bad_chars) 
                      8:  * Source code: ext/standard/string.c
                      9:  * Alias to functions: none
                     10: */
                     11: 
                     12: /*
                     13: * Test strcspn() : for error conditons
                     14: */
                     15: 
                     16: echo "*** Testing strcspn() : error conditions ***\n";
                     17: 
                     18: // Zero arguments
                     19: echo "\n-- Testing strcspn() function with Zero arguments --\n";
                     20: var_dump( strcspn() );
                     21: 
                     22: //Test strcspn with one more than the expected number of arguments
                     23: echo "\n-- Testing strcspn() function with more than expected no. of arguments --\n";
                     24: $str = 'string_val';
                     25: $mask = 'string_val';
                     26: $start = 2;
                     27: $len = 20;
                     28: 
                     29: 
                     30: $extra_arg = 10;
                     31: var_dump( strcspn($str,$mask,$start,$len, $extra_arg) );
                     32: 
                     33: // Testing strcspn withone less than the expected number of arguments
                     34: echo "\n-- Testing strcspn() function with less than expected no. of arguments --\n";
                     35: $str = 'string_val';
                     36: var_dump( strcspn($str) );
                     37: 
                     38: echo "Done"
                     39: ?>
                     40: --EXPECTF--
                     41: *** Testing strcspn() : error conditions ***
                     42: 
                     43: -- Testing strcspn() function with Zero arguments --
                     44: 
                     45: Warning: strcspn() expects at least 2 parameters, 0 given in %s on line %d
                     46: NULL
                     47: 
                     48: -- Testing strcspn() function with more than expected no. of arguments --
                     49: 
                     50: Warning: strcspn() expects at most 4 parameters, 5 given in %s on line %d
                     51: NULL
                     52: 
                     53: -- Testing strcspn() function with less than expected no. of arguments --
                     54: 
                     55: Warning: strcspn() expects at least 2 parameters, 1 given in %s on line %d
                     56: NULL
                     57: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>