File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
com.oracle.graal.python.test/src/tests
com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -707,6 +707,8 @@ def test_title_uni(self):
707707 self .assertEqual ('X\U00010427 x\U0001044F X\U00010427 x\U0001044F ' .title (),
708708 'X\U0001044F x\U0001044F X\U0001044F x\U0001044F ' )
709709 self .assertEqual ('fiNNISH' .title (), 'Finnish' )
710+ self .assertEqual ('bfiNNISH' .title (), 'Bfinnish' )
711+ self .assertEqual ('fifiNNfiISH' .title (), 'Fifinnfiish' )
710712 self .assertEqual ('A\u03a3 A' .title (), 'A\u03c3 a' )
711713
712714def test_same_id ():
Original file line number Diff line number Diff line change @@ -1547,13 +1547,12 @@ abstract static class TitleNode extends PythonUnaryBuiltinNode {
15471547 @ Specialization
15481548 @ TruffleBoundary
15491549 public String doTitle (String self ) {
1550- int [] codePoints = self .codePoints ().toArray ();
1551- int len = codePoints .length ;
1550+ int len = self .length ();
15521551 boolean shouldBeLowerCase = false ;
15531552 boolean translated ;
15541553 StringBuilder converted = new StringBuilder ();
1555- for (int i = 0 ; i < len ; i ++ ) {
1556- int ch = codePoints [ i ] ;
1554+ for (int offset = 0 ; offset < self . length (); ) {
1555+ int ch = self . codePointAt ( offset ) ;
15571556 translated = false ;
15581557 if (Character .isAlphabetic (ch )) {
15591558 if (shouldBeLowerCase ) {
@@ -1599,6 +1598,7 @@ public String doTitle(String self) {
15991598 converted .append (Character .toChars (ch ));
16001599 }
16011600 }
1601+ offset += Character .charCount (ch );
16021602 }
16031603 return converted .toString ();
16041604 }
You can’t perform that action at this time.
0 commit comments