Annotation of embedaddon/php/ext/standard/tests/strings/sscanf_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test sscanf() function : error conditions
3: --FILE--
4: <?php
5:
6: /* Prototype : mixed sscanf ( string $str , string $format [, mixed &$... ] )
7: * Description: Parses input from a string according to a format
8: * Source code: ext/standard/string.c
9: */
10: echo "*** Testing sscanf() : error conditions ***\n";
11:
12: $str = "Hello World";
13: $format = "%s %s";
14:
15: echo "\n-- Testing sscanf() function with no arguments --\n";
16: var_dump( sscanf() );
17:
18: echo "\n-- Testing sscanf() function with one argument --\n";
19: var_dump( sscanf($str) );
20:
21: echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n";
22:
23: var_dump( sscanf($str, $format, $str1, $str2, $extra_str) );
24:
25: ?>
26: ===DONE===
27: --EXPECTF--
28: *** Testing sscanf() : error conditions ***
29:
30: -- Testing sscanf() function with no arguments --
31:
32: Warning: sscanf() expects at least 2 parameters, 0 given in %s on line %d
33: NULL
34:
35: -- Testing sscanf() function with one argument --
36:
37: Warning: sscanf() expects at least 2 parameters, 1 given in %s on line %d
38: NULL
39:
40: -- Testing sscanf() function with more than expected no. of arguments --
41:
42: Warning: sscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
43: int(-1)
44: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>