File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -406,7 +406,6 @@ function test_decolorize() {
406406 }
407407
408408 function test_strwidth () {
409- $ this ->markTestSkipped ('Unknown failure ' );
410409 // Save.
411410 $ test_strwidth = getenv ( 'PHP_CLI_TOOLS_TEST_STRWIDTH ' );
412411 if ( function_exists ( 'mb_detect_order ' ) ) {
@@ -446,12 +445,14 @@ function test_strwidth() {
446445 }
447446
448447 // Nepali जस्ट ट॓स्ट गर्दै - 1st word: 3 spacing + 1 combining, 2nd word: 3 spacing + 2 combining, 3rd word: 3 spacing + 2 combining = 9 spacing chars + 2 spaces = 11 chars.
448+ // Note: ICU's grapheme_strlen() treats Devanagari conjuncts (consonant + virama + consonant) as single graphemes.
449+ // Modern ICU versions (54.1+) return 8 for this string, while PCRE \X returns 11.
449450 $ str = "\xe0\xa4\x9c\xe0\xa4\xb8\xe0\xa5\x8d\xe0\xa4\x9f \xe0\xa4\x9f\xe0\xa5\x93\xe0\xa4\xb8\xe0\xa5\x8d\xe0\xa4\x9f \xe0\xa4\x97\xe0\xa4\xb0\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x88" ;
450451
451452 putenv ( 'PHP_CLI_TOOLS_TEST_STRWIDTH ' );
452453
453454 if ( \cli \can_use_icu () ) {
454- $ this ->assertSame ( 11 , \cli \strwidth ( $ str ) ); // Tests grapheme_strlen().
455+ $ this ->assertSame ( 8 , \cli \strwidth ( $ str ) ); // Tests grapheme_strlen() - ICU treats conjuncts as single graphemes .
455456 putenv ( 'PHP_CLI_TOOLS_TEST_STRWIDTH=2 ' ); // Test preg_split( '/\X/u' ).
456457 $ this ->assertSame ( 11 , \cli \strwidth ( $ str ) );
457458 } else {
You can’t perform that action at this time.
0 commit comments