Annotation of embedaddon/php/ext/mbstring/tests/mb_strwidth.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: mb_strwidth()
                      3: --SKIPIF--
                      4: <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
                      5: --FILE--
                      6: <?php
                      7: // TODO: Add more encoding, strings.....
                      8: //$debug = true;
                      9: ini_set('include_path', dirname(__FILE__));
                     10: include_once('common.inc');
                     11: 
                     12: // EUC-JP
                     13: $euc_jp = '0123この文字列は日本語です。EUC-JPを使っています。日本語は面倒臭い。';
                     14: 
                     15: print  "1: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
                     16: /*
                     17: 
                     18: print  "2: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
                     19: print  "3: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
                     20: // Note: Did not start form -22 offset. Staring from 0.
                     21: print  "4: ". mb_strwidth($euc_jp, 'EUC-JP') . "\n";
                     22: 
                     23: $str = mb_strwidth($euc_jp, 100, -10,'...','EUC-JP');
                     24: ($str === "") ? print "5 OK\n" : print "NG: $str\n";
                     25: 
                     26: $str = mb_strwidth($euc_jp, -100, 10,'...','EUC-JP');
                     27: ($str !== "") ?        print "6 OK: $str\n" : print "NG: $str\n";
                     28: */
                     29: ?>
                     30: 
                     31: --EXPECT--
                     32: 1: 68

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>