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/mbstring/tests/mb_split.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/mbstring/tests/mb_split.phpt')
-rw-r--r-- | ext/mbstring/tests/mb_split.phpt | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/ext/mbstring/tests/mb_split.phpt b/ext/mbstring/tests/mb_split.phpt new file mode 100644 index 0000000..c10b0d7 --- /dev/null +++ b/ext/mbstring/tests/mb_split.phpt @@ -0,0 +1,67 @@ +--TEST-- +mb_split() +--SKIPIF-- +<?php +extension_loaded('mbstring') or die('skip mbstring not available'); +function_exists('mb_split') or die("skip mb_split() is not available in this build"); +?> +--INI-- +mbstring.func_overload=0 +--FILE-- +<?php + mb_regex_set_options( '' ); + mb_regex_encoding( 'EUC-JP' ); + + function verify_split( $spliton, $str, $count = 0 ) + { + $result1 = mb_split( $spliton, $str, $count ); + $result2 = split( $spliton, $str, $count ); + if ( $result1 == $result2 ) { + print "ok\n"; + } else { + print count($result1).'-'.count($result2)."\n"; + } + } + + var_dump( mb_split( b" ", b"a b c d e f g" ) + == mb_split( b"[[:space:]]", b"a\nb\tc\nd e f g" ) ); + + for ( $i = 0; $i < 5; ++$i ) { + verify_split( b" ", b"a\tb\tc\td e\tf g", $i ); + } + + for ( $i = 1; $i < 5; ++$i ) { + verify_split( b"\xa1\xa1+", b"\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1", $i ); + } +?> + +--EXPECTF-- +bool(true) + +Deprecated: Function split() is deprecated in %s on line %d +ok + +Deprecated: Function split() is deprecated in %s on line %d +ok + +Deprecated: Function split() is deprecated in %s on line %d +ok + +Deprecated: Function split() is deprecated in %s on line %d +ok + +Deprecated: Function split() is deprecated in %s on line %d +ok + +Deprecated: Function split() is deprecated in %s on line %d +ok + +Deprecated: Function split() is deprecated in %s on line %d +2-2 + +Deprecated: Function split() is deprecated in %s on line %d +3-3 + +Deprecated: Function split() is deprecated in %s on line %d +4-4 + |