Skip to content

Commit

Permalink
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion spec/truffle/tags/core/string/modulo_tags.txt
Original file line number Diff line number Diff line change
@@ -68,7 +68,6 @@ fails:String#% supports hex formats using %X for negative numbers
fails:String#% formats zero without prefix using %#x
fails:String#% formats zero without prefix using %#X
fails:String#% behaves as if calling Kernel#Integer for %b argument, if it does not respond to #to_ary
fails:String#% behaves as if calling Kernel#Integer for %o argument, if it does not respond to #to_ary
fails:String#% tries to convert the passed argument to an Array using #to_ary
fails:String#% behaves as if calling Kernel#Float for %e arguments, when the passed argument does not respond to #to_ary
fails:String#% behaves as if calling Kernel#Float for %e arguments, when the passed argument is hexadecimal string
Original file line number Diff line number Diff line change
@@ -63,6 +63,10 @@ public ByteList format(int spacePadding, int zeroPadding, DynamicObject value) {
formatted = bigInteger.toString();
break;

case 'o':
formatted = bigInteger.toString(8).toLowerCase(Locale.ENGLISH);
break;

case 'x':
formatted = bigInteger.toString(16).toLowerCase(Locale.ENGLISH);
break;
Original file line number Diff line number Diff line change
@@ -117,6 +117,7 @@ public PackNode parse(FormatTokenizer tokenizer) {
break;
case 'd':
case 'i':
case 'o':
case 'u':
case 'x':
case 'X':
@@ -151,6 +152,9 @@ public PackNode parse(FormatTokenizer tokenizer) {
case 'u':
format = 'd';
break;
case 'o':
format = 'o';
break;
case 'x':
case 'X':
format = directive.getType();
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
*/
public class FormatTokenizer {

private static final String TYPE_CHARS = "%-sdiuxXfgGeE";
private static final String TYPE_CHARS = "%-sdiuxXfgGeEo";

private final RubyContext context;
private final ByteList format;

0 comments on commit 19b5591

Please sign in to comment.