Annotation of embedaddon/php/ext/standard/tests/strings/strspn_error.phpt, revision 1.1

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

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