diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/strings/convert_cyr_string_error.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/strings/convert_cyr_string_error.phpt')
-rw-r--r-- | ext/standard/tests/strings/convert_cyr_string_error.phpt | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/ext/standard/tests/strings/convert_cyr_string_error.phpt b/ext/standard/tests/strings/convert_cyr_string_error.phpt new file mode 100644 index 0000000..844f2d7 --- /dev/null +++ b/ext/standard/tests/strings/convert_cyr_string_error.phpt @@ -0,0 +1,73 @@ +--TEST-- +Test convert_cyr_string() function : error conditions +--FILE-- +<?php + +/* Prototype : string convert_cyr_string ( string $str , string $from , string $to ) + * Description: Convert from one Cyrillic character set to another + * Source code: ext/standard/string.c +*/ + +$str = "hello"; +$from = "k"; +$to = "d"; +$extra_arg = 10; + +echo "*** Testing convert_cyr_string() : error conditions ***\n"; + +echo "\n-- Testing convert_cyr_string() function with no arguments --\n"; +var_dump( convert_cyr_string() ); + +echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n"; +var_dump( convert_cyr_string($str, $from) ); + +echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n"; +var_dump( convert_cyr_string($str, $from, $to, $extra_arg) ); + +echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n"; +var_dump(bin2hex( convert_cyr_string($str, "?", $to) )); + +echo "\n-- Testing convert_cyr_string() function with invalid 'to' character set --\n"; +var_dump(bin2hex( convert_cyr_string($str, $from, "?")) ); + +echo "\n-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --\n"; +var_dump(bin2hex( convert_cyr_string($str, ">", "?")) ); + +?> +===DONE=== +--EXPECTF-- +*** Testing convert_cyr_string() : error conditions *** + +-- Testing convert_cyr_string() function with no arguments -- + +Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d +NULL + +-- Testing convert_cyr_string() function with no 'to' character set -- + +Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d +NULL + +-- Testing convert_cyr_string() function with more than expected no. of arguments -- + +Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d +NULL + +-- Testing convert_cyr_string() function with invalid 'from' character set -- + +Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d +string(10) "68656c6c6f" + +-- Testing convert_cyr_string() function with invalid 'to' character set -- + +Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d +string(10) "68656c6c6f" + +-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set -- + +Warning: convert_cyr_string(): Unknown source charset: > in %s on line %d + +Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d +string(10) "68656c6c6f" + +===DONE===
\ No newline at end of file |