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

1.1       misho       1: --TEST--
                      2: Test printf() function : error conditions 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : int printf  ( string $format  [, mixed $args  [, mixed $...  ]] )
                      6:  * Description: Produces output according to format .
                      7:  * Source code: ext/standard/formatted_print.c
                      8:  */
                      9: 
                     10: echo "*** Testing printf() : error conditions ***\n";
                     11: 
                     12: // Zero arguments
                     13: echo "\n-- Testing printf() function with Zero arguments --\n";
                     14: var_dump( printf() );
                     15: 
                     16: echo "\n-- Testing printf() function with less than expected no. of arguments --\n";
                     17: $format1 = '%s';
                     18: $format2 = '%s%s';
                     19: $format3 = '%s%s%s';
                     20: $arg1 = 'one';
                     21: $arg2 = 'two';
                     22: 
                     23: echo "\n-- Call printf with one argument less than expected --\n";
                     24: var_dump( printf($format1) );  
                     25: var_dump( printf($format2,$arg1) );
                     26: var_dump( printf($format3,$arg1,$arg2) );
                     27: 
                     28: echo "\n-- Call printf with two argument less than expected --\n";
                     29: var_dump( printf($format2) );
                     30: var_dump( printf($format3,$arg1) );
                     31: 
                     32: echo "\n-- Call printf with three argument less than expected --\n";
                     33: var_dump( printf($format3) );
                     34: 
                     35: ?>
                     36: ===DONE===
                     37: --EXPECTF--
                     38: *** Testing printf() : error conditions ***
                     39: 
                     40: -- Testing printf() function with Zero arguments --
                     41: 
                     42: Warning: printf() expects at least 1 parameter, 0 given in %s on line %d
                     43: bool(false)
                     44: 
                     45: -- Testing printf() function with less than expected no. of arguments --
                     46: 
                     47: -- Call printf with one argument less than expected --
                     48: 
                     49: Warning: printf(): Too few arguments in %s on line %d
                     50: bool(false)
                     51: 
                     52: Warning: printf(): Too few arguments in %s on line %d
                     53: bool(false)
                     54: 
                     55: Warning: printf(): Too few arguments in %s on line %d
                     56: bool(false)
                     57: 
                     58: -- Call printf with two argument less than expected --
                     59: 
                     60: Warning: printf(): Too few arguments in %s on line %d
                     61: bool(false)
                     62: 
                     63: Warning: printf(): Too few arguments in %s on line %d
                     64: bool(false)
                     65: 
                     66: -- Call printf with three argument less than expected --
                     67: 
                     68: Warning: printf(): Too few arguments in %s on line %d
                     69: bool(false)
                     70: ===DONE===

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