Annotation of embedaddon/php/ext/standard/tests/strings/convert_cyr_string_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test convert_cyr_string() function : error conditions
3: --FILE--
4: <?php
5:
6: /* Prototype : string convert_cyr_string ( string $str , string $from , string $to )
7: * Description: Convert from one Cyrillic character set to another
8: * Source code: ext/standard/string.c
9: */
10:
11: $str = "hello";
12: $from = "k";
13: $to = "d";
14: $extra_arg = 10;
15:
16: echo "*** Testing convert_cyr_string() : error conditions ***\n";
17:
18: echo "\n-- Testing convert_cyr_string() function with no arguments --\n";
19: var_dump( convert_cyr_string() );
20:
21: echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n";
22: var_dump( convert_cyr_string($str, $from) );
23:
24: echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n";
25: var_dump( convert_cyr_string($str, $from, $to, $extra_arg) );
26:
27: echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n";
28: var_dump(bin2hex( convert_cyr_string($str, "?", $to) ));
29:
30: echo "\n-- Testing convert_cyr_string() function with invalid 'to' character set --\n";
31: var_dump(bin2hex( convert_cyr_string($str, $from, "?")) );
32:
33: echo "\n-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --\n";
34: var_dump(bin2hex( convert_cyr_string($str, ">", "?")) );
35:
36: ?>
37: ===DONE===
38: --EXPECTF--
39: *** Testing convert_cyr_string() : error conditions ***
40:
41: -- Testing convert_cyr_string() function with no arguments --
42:
43: Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d
44: NULL
45:
46: -- Testing convert_cyr_string() function with no 'to' character set --
47:
48: Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d
49: NULL
50:
51: -- Testing convert_cyr_string() function with more than expected no. of arguments --
52:
53: Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d
54: NULL
55:
56: -- Testing convert_cyr_string() function with invalid 'from' character set --
57:
58: Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d
59: string(10) "68656c6c6f"
60:
61: -- Testing convert_cyr_string() function with invalid 'to' character set --
62:
63: Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d
64: string(10) "68656c6c6f"
65:
66: -- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --
67:
68: Warning: convert_cyr_string(): Unknown source charset: > in %s on line %d
69:
70: Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d
71: string(10) "68656c6c6f"
72:
73: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>