Annotation of embedaddon/php/ext/mbstring/tests/mb_strimwidth.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mb_strimwidth()
! 3: --SKIPIF--
! 4: <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
! 5: --INI--
! 6: output_handler=
! 7: --FILE--
! 8: <?php
! 9: // TODO: Add more encoding
! 10: //$debug = true;
! 11: ini_set('include_path', dirname(__FILE__));
! 12: include_once('common.inc');
! 13:
! 14: // EUC-JP
! 15: $euc_jp = '0123この文字列は日本語です。EUC-JPを使っています。日本語は面倒臭い。';
! 16:
! 17: print "1: ". mb_strimwidth($euc_jp, 0, 15,'...','EUC-JP') . "\n";
! 18: print "2: ". mb_strimwidth($euc_jp, 0, 100,'...','EUC-JP') . "\n";
! 19: print "3: ". mb_strimwidth($euc_jp, 15, 100,'...','EUC-JP') . "\n";
! 20: // Note: Did not start form -22 offset. Staring from 0.
! 21: $str = mb_strimwidth($euc_jp,-22, 100,'...','EUC-JP');
! 22: ($str === FALSE) ? print "4 OK\n" : print "NG: $str\n";
! 23:
! 24: $str = mb_strimwidth($euc_jp, 100, -10,'...','EUC-JP');
! 25: ($str === FALSE) ? print "5 OK\n" : print "NG: $str\n";
! 26:
! 27: $str = mb_strimwidth($euc_jp, -100, 10,'...','EUC-JP');
! 28: ($str === FALSE) ? print "6 OK\n" : print "NG: $str\n";
! 29:
! 30: ?>
! 31:
! 32: --EXPECT--
! 33: 1: 0123この文字...
! 34: 2: 0123この文字列は日本語です。EUC-JPを使っています。日本語は面倒臭い。
! 35: 3: 。EUC-JPを使っています。日本語は面倒臭い。
! 36: ERR: Warning
! 37: 4 OK
! 38: ERR: Warning
! 39: 5 OK
! 40: ERR: Warning
! 41: 6 OK
! 42:
! 43:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>