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):
707
707
self .assertEqual ('X\U00010427 x\U0001044F X\U00010427 x\U0001044F ' .title (),
708
708
'X\U0001044F x\U0001044F X\U0001044F x\U0001044F ' )
709
709
self .assertEqual ('fiNNISH' .title (), 'Finnish' )
710
+ self .assertEqual ('bfiNNISH' .title (), 'Bfinnish' )
711
+ self .assertEqual ('fifiNNfiISH' .title (), 'Fifinnfiish' )
710
712
self .assertEqual ('A\u03a3 A' .title (), 'A\u03c3 a' )
711
713
712
714
def test_same_id ():
Original file line number Diff line number Diff line change @@ -1547,13 +1547,12 @@ abstract static class TitleNode extends PythonUnaryBuiltinNode {
1547
1547
@ Specialization
1548
1548
@ TruffleBoundary
1549
1549
public String doTitle (String self ) {
1550
- int [] codePoints = self .codePoints ().toArray ();
1551
- int len = codePoints .length ;
1550
+ int len = self .length ();
1552
1551
boolean shouldBeLowerCase = false ;
1553
1552
boolean translated ;
1554
1553
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 ) ;
1557
1556
translated = false ;
1558
1557
if (Character .isAlphabetic (ch )) {
1559
1558
if (shouldBeLowerCase ) {
@@ -1599,6 +1598,7 @@ public String doTitle(String self) {
1599
1598
converted .append (Character .toChars (ch ));
1600
1599
}
1601
1600
}
1601
+ offset += Character .charCount (ch );
1602
1602
}
1603
1603
return converted .toString ();
1604
1604
}
You can’t perform that action at this time.
0 commit comments